From 7366acb58ebad3edeec07b2cf593acd8ce3b6ee4 Mon Sep 17 00:00:00 2001 From: appflowy Date: Sat, 11 Jun 2022 15:51:53 +0800 Subject: [PATCH 01/11] chore: config board view plugin --- frontend/app_flowy/lib/plugin/plugin.dart | 3 + .../lib/startup/tasks/load_plugin.dart | 2 + .../application/board/board_bloc.dart | 0 .../presentation/home/home_screen.dart | 5 +- .../presentation/plugins/board/board.dart | 66 +++++++++++++++++++ .../plugins/board/src/board_page.dart | 15 +++++ 6 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 frontend/app_flowy/lib/workspace/application/board/board_bloc.dart create mode 100644 frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart create mode 100644 frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart diff --git a/frontend/app_flowy/lib/plugin/plugin.dart b/frontend/app_flowy/lib/plugin/plugin.dart index 8d30b122ad..3d21756605 100644 --- a/frontend/app_flowy/lib/plugin/plugin.dart +++ b/frontend/app_flowy/lib/plugin/plugin.dart @@ -14,6 +14,7 @@ enum DefaultPlugin { blank, trash, grid, + board, } extension FlowyDefaultPluginExt on DefaultPlugin { @@ -27,6 +28,8 @@ extension FlowyDefaultPluginExt on DefaultPlugin { return 2; case DefaultPlugin.grid: return 3; + case DefaultPlugin.board: + return 4; } } } diff --git a/frontend/app_flowy/lib/startup/tasks/load_plugin.dart b/frontend/app_flowy/lib/startup/tasks/load_plugin.dart index fd4bb7e2b9..d89bc83b37 100644 --- a/frontend/app_flowy/lib/startup/tasks/load_plugin.dart +++ b/frontend/app_flowy/lib/startup/tasks/load_plugin.dart @@ -1,6 +1,7 @@ import 'package:app_flowy/plugin/plugin.dart'; import 'package:app_flowy/startup/startup.dart'; import 'package:app_flowy/workspace/presentation/plugins/blank/blank.dart'; +import 'package:app_flowy/workspace/presentation/plugins/board/board.dart'; import 'package:app_flowy/workspace/presentation/plugins/doc/document.dart'; import 'package:app_flowy/workspace/presentation/plugins/grid/grid.dart'; import 'package:app_flowy/workspace/presentation/plugins/trash/trash.dart'; @@ -15,5 +16,6 @@ class PluginLoadTask extends LaunchTask { registerPlugin(builder: TrashPluginBuilder(), config: TrashPluginConfig()); registerPlugin(builder: DocumentPluginBuilder()); registerPlugin(builder: GridPluginBuilder(), config: GridPluginConfig()); + registerPlugin(builder: BoardPluginBuilder(), config: BoardPluginConfig()); } } diff --git a/frontend/app_flowy/lib/workspace/application/board/board_bloc.dart b/frontend/app_flowy/lib/workspace/application/board/board_bloc.dart new file mode 100644 index 0000000000..e69de29bb2 diff --git a/frontend/app_flowy/lib/workspace/presentation/home/home_screen.dart b/frontend/app_flowy/lib/workspace/presentation/home/home_screen.dart index 7e6d4abba2..df232b71e0 100644 --- a/frontend/app_flowy/lib/workspace/presentation/home/home_screen.dart +++ b/frontend/app_flowy/lib/workspace/presentation/home/home_screen.dart @@ -108,7 +108,10 @@ class _HomeScreenState extends State { final workspaceSetting = state.workspaceSetting; if (initialView == null && workspaceSetting.hasLatestView()) { initialView = workspaceSetting.latestView; - final plugin = makePlugin(pluginType: initialView!.pluginType, data: initialView); + final plugin = makePlugin( + pluginType: initialView!.pluginType, + data: initialView, + ); getIt().setPlugin(plugin); } diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart new file mode 100644 index 0000000000..fb55fc70c1 --- /dev/null +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart @@ -0,0 +1,66 @@ +import 'package:app_flowy/workspace/presentation/home/home_stack.dart'; +import 'package:app_flowy/workspace/presentation/plugins/widgets/left_bar_item.dart'; +import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart'; +import 'package:app_flowy/plugin/plugin.dart'; +import 'package:flutter/material.dart'; + +import 'src/board_page.dart'; + +class BoardPluginBuilder implements PluginBuilder { + @override + Plugin build(dynamic data) { + if (data is View) { + return BoardPlugin(pluginType: pluginType, view: data); + } else { + throw FlowyPluginException.invalidData; + } + } + + @override + String get menuName => "Board"; + + @override + PluginType get pluginType => DefaultPlugin.board.type(); + + @override + ViewDataType get dataType => ViewDataType.Grid; +} + +class BoardPluginConfig implements PluginConfig { + @override + bool get creatable => true; +} + +class BoardPlugin extends Plugin { + final View _view; + final PluginType _pluginType; + + BoardPlugin({ + required View view, + required PluginType pluginType, + }) : _pluginType = pluginType, + _view = view; + + @override + PluginDisplay get display => GridPluginDisplay(view: _view); + + @override + PluginId get id => _view.id; + + @override + PluginType get ty => _pluginType; +} + +class GridPluginDisplay extends PluginDisplay { + final View _view; + GridPluginDisplay({required View view, Key? key}) : _view = view; + + @override + Widget get leftBarItem => ViewLeftBarItem(view: _view); + + @override + Widget buildWidget() => BoardPage(view: _view); + + @override + List get navigationItems => [this]; +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart new file mode 100644 index 0000000000..6ef88d7fe6 --- /dev/null +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart @@ -0,0 +1,15 @@ +import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart'; +import 'package:flutter/material.dart'; + +class BoardPage extends StatelessWidget { + final View _view; + + const BoardPage({required View view, Key? key}) + : _view = view, + super(key: key); + + @override + Widget build(BuildContext context) { + return Container(); + } +} From bf5247066db9291f2a52496ee974f8424da5c5a6 Mon Sep 17 00:00:00 2001 From: appflowy Date: Sat, 11 Jun 2022 17:13:52 +0800 Subject: [PATCH 02/11] refactor: sqlite schema --- .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../migrations/2021-07-22-234458_flowy-editor/down.sql | 2 -- .../migrations/2021-07-22-234458_flowy-editor/up.sql | 7 ------- .../down.sql | 0 .../up.sql | 0 .../migrations/2022-03-04-101530_flowy-grid/down.sql | 2 -- .../migrations/2022-03-04-101530_flowy-grid/up.sql | 5 ----- .../down.sql | 1 + .../up.sql | 4 ++++ .../down.sql | 0 .../up.sql | 0 .../migrations/2022-06-11-090029_view-add-col/down.sql | 1 + .../migrations/2022-06-11-090029_view-add-col/up.sql | 2 ++ frontend/rust-lib/flowy-database/src/schema.rs | 10 +--------- .../src/services/persistence/version_1/view_sql.rs | 3 ++- 18 files changed, 11 insertions(+), 26 deletions(-) rename frontend/rust-lib/flowy-database/migrations/{2021-07-09-063045_flowy-user => 2021-07-09-063045_user}/down.sql (100%) rename frontend/rust-lib/flowy-database/migrations/{2021-07-09-063045_flowy-user => 2021-07-09-063045_user}/up.sql (100%) rename frontend/rust-lib/flowy-database/migrations/{2021-07-14-022241_flowy-user => 2021-07-14-022241_user-add-col}/down.sql (100%) rename frontend/rust-lib/flowy-database/migrations/{2021-07-14-022241_flowy-user => 2021-07-14-022241_user-add-col}/up.sql (100%) delete mode 100644 frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/down.sql delete mode 100644 frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/up.sql rename frontend/rust-lib/flowy-database/migrations/{2021-09-22-074638_flowy-doc-op => 2021-09-22-074638_revision}/down.sql (100%) rename frontend/rust-lib/flowy-database/migrations/{2021-09-22-074638_flowy-doc-op => 2021-09-22-074638_revision}/up.sql (100%) delete mode 100644 frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/down.sql delete mode 100644 frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/up.sql rename frontend/rust-lib/flowy-database/migrations/{2022-03-11-025536_flowy-grid => 2022-03-11-025536_grid}/down.sql (58%) rename frontend/rust-lib/flowy-database/migrations/{2022-03-11-025536_flowy-grid => 2022-03-11-025536_grid}/up.sql (85%) rename frontend/rust-lib/flowy-database/migrations/{2022-04-05-015536_flowy-grid-block-index => 2022-04-05-015536_grid-block-index}/down.sql (100%) rename frontend/rust-lib/flowy-database/migrations/{2022-04-05-015536_flowy-grid-block-index => 2022-04-05-015536_grid-block-index}/up.sql (100%) create mode 100644 frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/down.sql create mode 100644 frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/up.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_flowy-user/down.sql b/frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_user/down.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_flowy-user/down.sql rename to frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_user/down.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_flowy-user/up.sql b/frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_user/up.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_flowy-user/up.sql rename to frontend/rust-lib/flowy-database/migrations/2021-07-09-063045_user/up.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_flowy-user/down.sql b/frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_user-add-col/down.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_flowy-user/down.sql rename to frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_user-add-col/down.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_flowy-user/up.sql b/frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_user-add-col/up.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_flowy-user/up.sql rename to frontend/rust-lib/flowy-database/migrations/2021-07-14-022241_user-add-col/up.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/down.sql b/frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/down.sql deleted file mode 100644 index 41dd39b71f..0000000000 --- a/frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/down.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This file should undo anything in `up.sql` -DROP TABLE doc_table; \ No newline at end of file diff --git a/frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/up.sql b/frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/up.sql deleted file mode 100644 index c5b88ab96f..0000000000 --- a/frontend/rust-lib/flowy-database/migrations/2021-07-22-234458_flowy-editor/up.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Your SQL goes here -CREATE TABLE doc_table ( - id TEXT NOT NULL PRIMARY KEY, --- data BLOB NOT NULL DEFAULT (x''), - data TEXT NOT NULL DEFAULT '', - rev_id BIGINT NOT NULL DEFAULT 0 -); \ No newline at end of file diff --git a/frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_flowy-doc-op/down.sql b/frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_revision/down.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_flowy-doc-op/down.sql rename to frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_revision/down.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_flowy-doc-op/up.sql b/frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_revision/up.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_flowy-doc-op/up.sql rename to frontend/rust-lib/flowy-database/migrations/2021-09-22-074638_revision/up.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/down.sql b/frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/down.sql deleted file mode 100644 index 96473ec177..0000000000 --- a/frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/down.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This file should undo anything in `up.sql` -DROP TABLE kv_table; \ No newline at end of file diff --git a/frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/up.sql b/frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/up.sql deleted file mode 100644 index edde5d7dfa..0000000000 --- a/frontend/rust-lib/flowy-database/migrations/2022-03-04-101530_flowy-grid/up.sql +++ /dev/null @@ -1,5 +0,0 @@ --- Your SQL goes here -CREATE TABLE kv_table ( - key TEXT NOT NULL PRIMARY KEY, - value BLOB NOT NULL DEFAULT (x'') -); \ No newline at end of file diff --git a/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_flowy-grid/down.sql b/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_grid/down.sql similarity index 58% rename from frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_flowy-grid/down.sql rename to frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_grid/down.sql index 9d48f0fb8a..54ad291ac7 100644 --- a/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_flowy-grid/down.sql +++ b/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_grid/down.sql @@ -1,3 +1,4 @@ -- This file should undo anything in `up.sql` +DROP TABLE kv_table; DROP TABLE grid_rev_table; DROP TABLE grid_meta_rev_table; \ No newline at end of file diff --git a/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_flowy-grid/up.sql b/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_grid/up.sql similarity index 85% rename from frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_flowy-grid/up.sql rename to frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_grid/up.sql index 4ce278ec8f..655533fc93 100644 --- a/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_flowy-grid/up.sql +++ b/frontend/rust-lib/flowy-database/migrations/2022-03-11-025536_grid/up.sql @@ -1,4 +1,8 @@ -- Your SQL goes here +CREATE TABLE kv_table ( + key TEXT NOT NULL PRIMARY KEY, + value BLOB NOT NULL DEFAULT (x'') +); CREATE TABLE grid_rev_table ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, object_id TEXT NOT NULL DEFAULT '', diff --git a/frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_flowy-grid-block-index/down.sql b/frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_grid-block-index/down.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_flowy-grid-block-index/down.sql rename to frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_grid-block-index/down.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_flowy-grid-block-index/up.sql b/frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_grid-block-index/up.sql similarity index 100% rename from frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_flowy-grid-block-index/up.sql rename to frontend/rust-lib/flowy-database/migrations/2022-04-05-015536_grid-block-index/up.sql diff --git a/frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/down.sql b/frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/down.sql new file mode 100644 index 0000000000..291a97c5ce --- /dev/null +++ b/frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/down.sql @@ -0,0 +1 @@ +-- This file should undo anything in `up.sql` \ No newline at end of file diff --git a/frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/up.sql b/frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/up.sql new file mode 100644 index 0000000000..c4545a457c --- /dev/null +++ b/frontend/rust-lib/flowy-database/migrations/2022-06-11-090029_view-add-col/up.sql @@ -0,0 +1,2 @@ +-- Your SQL goes here +ALTER TABLE view_table ADD COLUMN ext_data TEXT NOT NULL DEFAULT ''; \ No newline at end of file diff --git a/frontend/rust-lib/flowy-database/src/schema.rs b/frontend/rust-lib/flowy-database/src/schema.rs index 8fddd037e0..b131adf05f 100644 --- a/frontend/rust-lib/flowy-database/src/schema.rs +++ b/frontend/rust-lib/flowy-database/src/schema.rs @@ -13,14 +13,6 @@ table! { } } -table! { - doc_table (id) { - id -> Text, - data -> Text, - rev_id -> BigInt, - } -} - table! { grid_block_index_table (row_id) { row_id -> Text, @@ -102,6 +94,7 @@ table! { view_type -> Integer, version -> BigInt, is_trash -> Bool, + ext_data -> Text, } } @@ -119,7 +112,6 @@ table! { allow_tables_to_appear_in_same_query!( app_table, - doc_table, grid_block_index_table, grid_meta_rev_table, grid_rev_table, diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs index bda73dd71d..cbbcf48bfb 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs @@ -79,6 +79,7 @@ pub(crate) struct ViewTable { pub view_type: SqlViewDataType, pub version: i64, pub is_trash: bool, + pub ext_data: String, } impl ViewTable { @@ -120,7 +121,7 @@ impl std::convert::From for View { modified_time: table.modified_time, version: table.version, create_time: table.create_time, - ext_data: "".to_string(), + ext_data: table.ext_data, thumbnail: table.thumbnail, // Store the view in ViewTable was deprecated since v0.0.2. // No need worry about plugin_type. From 2b499ee62b874bc3283d759d025c3eb3311392a1 Mon Sep 17 00:00:00 2001 From: appflowy Date: Sat, 11 Jun 2022 21:59:08 +0800 Subject: [PATCH 03/11] chore: separate json serde from pb struct --- .../persistence/version_1/view_sql.rs | 1 + .../src/entities/app.rs | 47 +++++++++++++- .../src/entities/trash.rs | 27 +++++++- .../src/entities/view.rs | 65 +++++++++++++++++-- .../src/entities/workspace.rs | 31 ++++++++- 5 files changed, 160 insertions(+), 11 deletions(-) diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs index cbbcf48bfb..0677110cda 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs @@ -98,6 +98,7 @@ impl ViewTable { create_time: view.create_time, thumbnail: view.thumbnail, view_type: data_type, + ext_data: view.ext_data, version: 0, is_trash: false, } diff --git a/shared-lib/flowy-folder-data-model/src/entities/app.rs b/shared-lib/flowy-folder-data-model/src/entities/app.rs index 2c87c882ab..1639082f00 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/app.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/app.rs @@ -1,3 +1,4 @@ +use crate::entities::view::ViewSerde; use crate::{ entities::view::RepeatedView, errors::ErrorCode, @@ -15,7 +16,7 @@ use std::convert::TryInto; pub fn gen_app_id() -> String { nanoid!(10) } -#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone, Serialize, Deserialize)] +#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone)] pub struct App { #[pb(index = 1)] pub id: String, @@ -42,8 +43,41 @@ pub struct App { pub create_time: i64, } -#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone, Serialize, Deserialize)] -#[serde(transparent)] +#[derive(Serialize, Deserialize)] +pub struct AppSerde { + pub id: String, + + pub workspace_id: String, + + pub name: String, + + pub desc: String, + + pub belongings: Vec, + + pub version: i64, + + pub modified_time: i64, + + pub create_time: i64, +} + +impl std::convert::From for App { + fn from(app_serde: AppSerde) -> Self { + App { + id: app_serde.id, + workspace_id: app_serde.workspace_id, + name: app_serde.name, + desc: app_serde.desc, + belongings: app_serde.belongings.into(), + version: app_serde.version, + modified_time: app_serde.modified_time, + create_time: app_serde.create_time, + } + } +} + +#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)] pub struct RepeatedApp { #[pb(index = 1)] pub items: Vec, @@ -51,6 +85,13 @@ pub struct RepeatedApp { impl_def_and_def_mut!(RepeatedApp, App); +impl std::convert::From> for RepeatedApp { + fn from(values: Vec) -> Self { + let items = values.into_iter().map(|value| value.into()).collect::>(); + RepeatedApp { items } + } +} + #[derive(ProtoBuf, Default)] pub struct CreateAppPayload { #[pb(index = 1)] diff --git a/shared-lib/flowy-folder-data-model/src/entities/trash.rs b/shared-lib/flowy-folder-data-model/src/entities/trash.rs index 73d8a7e242..4f61a21344 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/trash.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/trash.rs @@ -3,7 +3,7 @@ use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use serde::{Deserialize, Serialize}; use std::fmt::Formatter; -#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone, Serialize, Deserialize)] +#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone)] pub struct Trash { #[pb(index = 1)] pub id: String, @@ -21,6 +21,31 @@ pub struct Trash { pub ty: TrashType, } +#[derive(Serialize, Deserialize)] +pub struct TrashSerde { + pub id: String, + + pub name: String, + + pub modified_time: i64, + + pub create_time: i64, + + pub ty: TrashType, +} + +impl std::convert::From for Trash { + fn from(trash_serde: TrashSerde) -> Self { + Trash { + id: trash_serde.id, + name: trash_serde.name, + modified_time: trash_serde.modified_time, + create_time: trash_serde.create_time, + ty: trash_serde.ty, + } + } +} + #[derive(PartialEq, Debug, Default, ProtoBuf, Clone)] pub struct RepeatedTrash { #[pb(index = 1)] diff --git a/shared-lib/flowy-folder-data-model/src/entities/view.rs b/shared-lib/flowy-folder-data-model/src/entities/view.rs index 400649dac1..3e1405137a 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/view.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/view.rs @@ -17,7 +17,7 @@ pub fn gen_view_id() -> String { nanoid!(10) } -#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone, Serialize, Deserialize)] +#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone)] pub struct View { #[pb(index = 1)] pub id: String, @@ -32,7 +32,6 @@ pub struct View { pub desc: String, #[pb(index = 5)] - #[serde(default)] pub data_type: ViewDataType, #[pb(index = 6)] @@ -48,14 +47,42 @@ pub struct View { pub create_time: i64, #[pb(index = 10)] - #[serde(default)] pub ext_data: String, #[pb(index = 11)] - #[serde(default)] pub thumbnail: String, #[pb(index = 12)] + pub plugin_type: i32, +} + +#[derive(Serialize, Deserialize)] +pub struct ViewSerde { + pub id: String, + + pub belong_to_id: String, + + pub name: String, + + pub desc: String, + + #[serde(default)] + pub data_type: ViewDataType, + + pub version: i64, + + pub belongings: Vec, + + pub modified_time: i64, + + pub create_time: i64, + + #[serde(default)] + pub ext_data: String, + + #[serde(default)] + pub thumbnail: String, + #[serde(default = "default_plugin_type")] pub plugin_type: i32, } @@ -64,8 +91,27 @@ fn default_plugin_type() -> i32 { 0 } -#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone, Serialize, Deserialize)] -#[serde(transparent)] +impl std::convert::From for View { + fn from(view_serde: ViewSerde) -> Self { + View { + id: view_serde.id, + belong_to_id: view_serde.belong_to_id, + name: view_serde.name, + desc: view_serde.desc, + data_type: view_serde.data_type, + version: view_serde.version, + belongings: view_serde.belongings.into(), + modified_time: view_serde.modified_time, + create_time: view_serde.create_time, + ext_data: view_serde.ext_data, + thumbnail: view_serde.thumbnail, + plugin_type: view_serde.plugin_type, + } + } +} + +#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)] +// #[serde(transparent)] pub struct RepeatedView { #[pb(index = 1)] pub items: Vec, @@ -73,6 +119,13 @@ pub struct RepeatedView { impl_def_and_def_mut!(RepeatedView, View); +impl std::convert::From> for RepeatedView { + fn from(values: Vec) -> Self { + let items = values.into_iter().map(|value| value.into()).collect::>(); + RepeatedView { items } + } +} + impl std::convert::From for Trash { fn from(view: View) -> Self { Trash { diff --git a/shared-lib/flowy-folder-data-model/src/entities/workspace.rs b/shared-lib/flowy-folder-data-model/src/entities/workspace.rs index 0b479f4477..b4f63502f2 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/workspace.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/workspace.rs @@ -1,3 +1,4 @@ +use crate::entities::app::AppSerde; use crate::{ entities::{app::RepeatedApp, view::View}, errors::*, @@ -12,7 +13,7 @@ use std::convert::TryInto; pub fn gen_workspace_id() -> String { nanoid!(10) } -#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone, Serialize, Deserialize)] +#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone)] pub struct Workspace { #[pb(index = 1)] pub id: String, @@ -33,6 +34,34 @@ pub struct Workspace { pub create_time: i64, } +#[derive(Serialize, Deserialize)] +pub struct WorkspaceSerde { + pub id: String, + + pub name: String, + + pub desc: String, + + pub apps: Vec, + + pub modified_time: i64, + + pub create_time: i64, +} + +impl std::convert::From for Workspace { + fn from(workspace_serde: WorkspaceSerde) -> Self { + Workspace { + id: workspace_serde.id, + name: workspace_serde.name, + desc: workspace_serde.desc, + apps: workspace_serde.apps.into(), + modified_time: workspace_serde.modified_time, + create_time: workspace_serde.create_time, + } + } +} + #[derive(PartialEq, Debug, Default, ProtoBuf)] pub struct RepeatedWorkspace { #[pb(index = 1)] From c2fad5021b3f2842ac532c62f96631d15d335f54 Mon Sep 17 00:00:00 2001 From: appflowy Date: Sun, 12 Jun 2022 22:01:02 +0800 Subject: [PATCH 04/11] refactor: add folder entities's revision objects --- .../tests/workspace/folder_test.rs | 13 ++- .../flowy-folder/tests/workspace/script.rs | 15 +-- .../src/entities/app.rs | 44 +-------- .../src/entities/mod.rs | 5 + .../src/entities/trash.rs | 25 ----- .../src/entities/view.rs | 63 +------------ .../src/entities/workspace.rs | 31 +------ shared-lib/flowy-folder-data-model/src/lib.rs | 1 + .../src/revision/app.rs | 70 ++++++++++++++ .../src/revision/mod.rs | 9 ++ .../src/revision/trash.rs | 39 ++++++++ .../src/revision/view.rs | 93 +++++++++++++++++++ .../src/revision/workspace.rs | 44 +++++++++ .../flowy-sync/src/client_folder/builder.rs | 15 ++- .../src/client_folder/folder_pad.rs | 57 +++++++----- .../src/client_grid/grid_meta_pad.rs | 7 +- 16 files changed, 325 insertions(+), 206 deletions(-) create mode 100644 shared-lib/flowy-folder-data-model/src/revision/app.rs create mode 100644 shared-lib/flowy-folder-data-model/src/revision/mod.rs create mode 100644 shared-lib/flowy-folder-data-model/src/revision/trash.rs create mode 100644 shared-lib/flowy-folder-data-model/src/revision/view.rs create mode 100644 shared-lib/flowy-folder-data-model/src/revision/workspace.rs diff --git a/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs b/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs index 68a1bcea65..b9fc8c2585 100644 --- a/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs +++ b/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs @@ -1,7 +1,7 @@ use crate::script::{invalid_workspace_name_test_case, FolderScript::*, FolderTest}; - use flowy_folder::entities::workspace::CreateWorkspacePayload; use flowy_folder_data_model::entities::view::ViewDataType; +use flowy_folder_data_model::revision::{AppRevision, WorkspaceRevision}; use flowy_revision::disk::RevisionState; use flowy_test::{event_builder::*, FlowySDKTest}; @@ -38,11 +38,12 @@ async fn workspace_create() { async fn workspace_read() { let mut test = FolderTest::new().await; let workspace = test.workspace.clone(); - let json = serde_json::to_string(&workspace).unwrap(); + let workspace_revision: WorkspaceRevision = workspace.clone().into(); + let json = serde_json::to_string(&workspace_revision).unwrap(); test.run_scripts(vec![ ReadWorkspace(Some(workspace.id.clone())), - AssertWorkspaceJson(json), + AssertWorkspaceRevisionJson(json), AssertWorkspace(workspace), ]) .await; @@ -58,8 +59,10 @@ async fn workspace_create_with_apps() { .await; let app = test.app.clone(); - let json = serde_json::to_string(&app).unwrap(); - test.run_scripts(vec![ReadApp(app.id), AssertAppJson(json)]).await; + let app_revision: AppRevision = app.clone().into(); + let json = serde_json::to_string(&app_revision).unwrap(); + test.run_scripts(vec![ReadApp(app.id), AssertAppRevisionJson(json)]) + .await; } #[tokio::test] diff --git a/frontend/rust-lib/flowy-folder/tests/workspace/script.rs b/frontend/rust-lib/flowy-folder/tests/workspace/script.rs index 39f023ca7d..e4fcc78fa4 100644 --- a/frontend/rust-lib/flowy-folder/tests/workspace/script.rs +++ b/frontend/rust-lib/flowy-folder/tests/workspace/script.rs @@ -14,6 +14,7 @@ use flowy_folder_data_model::entities::{ view::{CreateViewPayload, UpdateViewPayload}, workspace::{CreateWorkspacePayload, RepeatedWorkspace}, }; +use flowy_folder_data_model::revision::{AppRevision, WorkspaceRevision}; use flowy_revision::disk::RevisionState; use flowy_revision::REVISION_WRITE_INTERVAL_IN_MILLIS; use flowy_sync::entities::text_block_info::TextBlockInfo; @@ -28,7 +29,7 @@ pub enum FolderScript { name: String, desc: String, }, - AssertWorkspaceJson(String), + AssertWorkspaceRevisionJson(String), AssertWorkspace(Workspace), ReadWorkspace(Option), @@ -37,7 +38,7 @@ pub enum FolderScript { name: String, desc: String, }, - AssertAppJson(String), + AssertAppRevisionJson(String), AssertApp(App), ReadApp(String), UpdateApp { @@ -138,12 +139,13 @@ impl FolderTest { let workspace = create_workspace(sdk, &name, &desc).await; self.workspace = workspace; } - FolderScript::AssertWorkspaceJson(expected_json) => { + FolderScript::AssertWorkspaceRevisionJson(expected_json) => { let workspace = read_workspace(sdk, Some(self.workspace.id.clone())) .await .pop() .unwrap(); - let json = serde_json::to_string(&workspace).unwrap(); + let workspace_revision: WorkspaceRevision = workspace.into(); + let json = serde_json::to_string(&workspace_revision).unwrap(); assert_eq!(json, expected_json); } FolderScript::AssertWorkspace(workspace) => { @@ -157,8 +159,9 @@ impl FolderTest { let app = create_app(sdk, &self.workspace.id, &name, &desc).await; self.app = app; } - FolderScript::AssertAppJson(expected_json) => { - let json = serde_json::to_string(&self.app).unwrap(); + FolderScript::AssertAppRevisionJson(expected_json) => { + let app_revision: AppRevision = self.app.clone().into(); + let json = serde_json::to_string(&app_revision).unwrap(); assert_eq!(json, expected_json); } FolderScript::AssertApp(app) => { diff --git a/shared-lib/flowy-folder-data-model/src/entities/app.rs b/shared-lib/flowy-folder-data-model/src/entities/app.rs index 1639082f00..cdf4c8fa69 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/app.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/app.rs @@ -1,4 +1,3 @@ -use crate::entities::view::ViewSerde; use crate::{ entities::view::RepeatedView, errors::ErrorCode, @@ -10,7 +9,7 @@ use crate::{ }; use flowy_derive::ProtoBuf; use nanoid::nanoid; -use serde::{Deserialize, Serialize}; + use std::convert::TryInto; pub fn gen_app_id() -> String { @@ -43,40 +42,6 @@ pub struct App { pub create_time: i64, } -#[derive(Serialize, Deserialize)] -pub struct AppSerde { - pub id: String, - - pub workspace_id: String, - - pub name: String, - - pub desc: String, - - pub belongings: Vec, - - pub version: i64, - - pub modified_time: i64, - - pub create_time: i64, -} - -impl std::convert::From for App { - fn from(app_serde: AppSerde) -> Self { - App { - id: app_serde.id, - workspace_id: app_serde.workspace_id, - name: app_serde.name, - desc: app_serde.desc, - belongings: app_serde.belongings.into(), - version: app_serde.version, - modified_time: app_serde.modified_time, - create_time: app_serde.create_time, - } - } -} - #[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)] pub struct RepeatedApp { #[pb(index = 1)] @@ -85,13 +50,6 @@ pub struct RepeatedApp { impl_def_and_def_mut!(RepeatedApp, App); -impl std::convert::From> for RepeatedApp { - fn from(values: Vec) -> Self { - let items = values.into_iter().map(|value| value.into()).collect::>(); - RepeatedApp { items } - } -} - #[derive(ProtoBuf, Default)] pub struct CreateAppPayload { #[pb(index = 1)] diff --git a/shared-lib/flowy-folder-data-model/src/entities/mod.rs b/shared-lib/flowy-folder-data-model/src/entities/mod.rs index 3ee0f4b591..72ffbaebcf 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/mod.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/mod.rs @@ -2,3 +2,8 @@ pub mod app; pub mod trash; pub mod view; pub mod workspace; + +pub use app::*; +pub use trash::*; +pub use view::*; +pub use workspace::*; diff --git a/shared-lib/flowy-folder-data-model/src/entities/trash.rs b/shared-lib/flowy-folder-data-model/src/entities/trash.rs index 4f61a21344..bd9d101cb4 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/trash.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/trash.rs @@ -21,31 +21,6 @@ pub struct Trash { pub ty: TrashType, } -#[derive(Serialize, Deserialize)] -pub struct TrashSerde { - pub id: String, - - pub name: String, - - pub modified_time: i64, - - pub create_time: i64, - - pub ty: TrashType, -} - -impl std::convert::From for Trash { - fn from(trash_serde: TrashSerde) -> Self { - Trash { - id: trash_serde.id, - name: trash_serde.name, - modified_time: trash_serde.modified_time, - create_time: trash_serde.create_time, - ty: trash_serde.ty, - } - } -} - #[derive(PartialEq, Debug, Default, ProtoBuf, Clone)] pub struct RepeatedTrash { #[pb(index = 1)] diff --git a/shared-lib/flowy-folder-data-model/src/entities/view.rs b/shared-lib/flowy-folder-data-model/src/entities/view.rs index 3e1405137a..7b29bd6c37 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/view.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/view.rs @@ -9,7 +9,7 @@ use crate::{ }; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use nanoid::nanoid; -use serde::{Deserialize, Serialize}; + use serde_repr::*; use std::convert::TryInto; @@ -56,60 +56,6 @@ pub struct View { pub plugin_type: i32, } -#[derive(Serialize, Deserialize)] -pub struct ViewSerde { - pub id: String, - - pub belong_to_id: String, - - pub name: String, - - pub desc: String, - - #[serde(default)] - pub data_type: ViewDataType, - - pub version: i64, - - pub belongings: Vec, - - pub modified_time: i64, - - pub create_time: i64, - - #[serde(default)] - pub ext_data: String, - - #[serde(default)] - pub thumbnail: String, - - #[serde(default = "default_plugin_type")] - pub plugin_type: i32, -} - -fn default_plugin_type() -> i32 { - 0 -} - -impl std::convert::From for View { - fn from(view_serde: ViewSerde) -> Self { - View { - id: view_serde.id, - belong_to_id: view_serde.belong_to_id, - name: view_serde.name, - desc: view_serde.desc, - data_type: view_serde.data_type, - version: view_serde.version, - belongings: view_serde.belongings.into(), - modified_time: view_serde.modified_time, - create_time: view_serde.create_time, - ext_data: view_serde.ext_data, - thumbnail: view_serde.thumbnail, - plugin_type: view_serde.plugin_type, - } - } -} - #[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)] // #[serde(transparent)] pub struct RepeatedView { @@ -119,13 +65,6 @@ pub struct RepeatedView { impl_def_and_def_mut!(RepeatedView, View); -impl std::convert::From> for RepeatedView { - fn from(values: Vec) -> Self { - let items = values.into_iter().map(|value| value.into()).collect::>(); - RepeatedView { items } - } -} - impl std::convert::From for Trash { fn from(view: View) -> Self { Trash { diff --git a/shared-lib/flowy-folder-data-model/src/entities/workspace.rs b/shared-lib/flowy-folder-data-model/src/entities/workspace.rs index b4f63502f2..66f11ab9b0 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/workspace.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/workspace.rs @@ -1,4 +1,3 @@ -use crate::entities::app::AppSerde; use crate::{ entities::{app::RepeatedApp, view::View}, errors::*, @@ -7,7 +6,7 @@ use crate::{ }; use flowy_derive::ProtoBuf; use nanoid::nanoid; -use serde::{Deserialize, Serialize}; + use std::convert::TryInto; pub fn gen_workspace_id() -> String { @@ -34,34 +33,6 @@ pub struct Workspace { pub create_time: i64, } -#[derive(Serialize, Deserialize)] -pub struct WorkspaceSerde { - pub id: String, - - pub name: String, - - pub desc: String, - - pub apps: Vec, - - pub modified_time: i64, - - pub create_time: i64, -} - -impl std::convert::From for Workspace { - fn from(workspace_serde: WorkspaceSerde) -> Self { - Workspace { - id: workspace_serde.id, - name: workspace_serde.name, - desc: workspace_serde.desc, - apps: workspace_serde.apps.into(), - modified_time: workspace_serde.modified_time, - create_time: workspace_serde.create_time, - } - } -} - #[derive(PartialEq, Debug, Default, ProtoBuf)] pub struct RepeatedWorkspace { #[pb(index = 1)] diff --git a/shared-lib/flowy-folder-data-model/src/lib.rs b/shared-lib/flowy-folder-data-model/src/lib.rs index 0621902466..e1f796b672 100644 --- a/shared-lib/flowy-folder-data-model/src/lib.rs +++ b/shared-lib/flowy-folder-data-model/src/lib.rs @@ -6,6 +6,7 @@ mod macros; // #[cfg(feature = "backend")] pub mod protobuf; +pub mod revision; pub mod user_default; pub mod errors { diff --git a/shared-lib/flowy-folder-data-model/src/revision/app.rs b/shared-lib/flowy-folder-data-model/src/revision/app.rs new file mode 100644 index 0000000000..3ed12ca933 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/revision/app.rs @@ -0,0 +1,70 @@ +use crate::entities::app::App; +use crate::entities::RepeatedApp; +use crate::revision::ViewRevision; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct AppRevision { + pub id: String, + + pub workspace_id: String, + + pub name: String, + + pub desc: String, + + pub belongings: Vec, + + pub version: i64, + + pub modified_time: i64, + + pub create_time: i64, +} + +impl std::convert::From for App { + fn from(app_serde: AppRevision) -> Self { + App { + id: app_serde.id, + workspace_id: app_serde.workspace_id, + name: app_serde.name, + desc: app_serde.desc, + belongings: app_serde.belongings.into(), + version: app_serde.version, + modified_time: app_serde.modified_time, + create_time: app_serde.create_time, + } + } +} + +impl std::convert::From for AppRevision { + fn from(app: App) -> Self { + AppRevision { + id: app.id, + workspace_id: app.workspace_id, + name: app.name, + desc: app.desc, + belongings: app.belongings.into(), + version: app.version, + modified_time: app.modified_time, + create_time: app.create_time, + } + } +} + +impl std::convert::From> for RepeatedApp { + fn from(values: Vec) -> Self { + let items = values.into_iter().map(|value| value.into()).collect::>(); + RepeatedApp { items } + } +} + +impl std::convert::From for Vec { + fn from(repeated_app: RepeatedApp) -> Self { + repeated_app + .items + .into_iter() + .map(|value| value.into()) + .collect::>() + } +} diff --git a/shared-lib/flowy-folder-data-model/src/revision/mod.rs b/shared-lib/flowy-folder-data-model/src/revision/mod.rs new file mode 100644 index 0000000000..d31c9b72e8 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/revision/mod.rs @@ -0,0 +1,9 @@ +mod app; +mod trash; +mod view; +mod workspace; + +pub use app::*; +pub use trash::*; +pub use view::*; +pub use workspace::*; diff --git a/shared-lib/flowy-folder-data-model/src/revision/trash.rs b/shared-lib/flowy-folder-data-model/src/revision/trash.rs new file mode 100644 index 0000000000..f4a4d3a932 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/revision/trash.rs @@ -0,0 +1,39 @@ +use crate::entities::trash::{Trash, TrashType}; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct TrashRevision { + pub id: String, + + pub name: String, + + pub modified_time: i64, + + pub create_time: i64, + + pub ty: TrashType, +} + +impl std::convert::From for Trash { + fn from(trash_serde: TrashRevision) -> Self { + Trash { + id: trash_serde.id, + name: trash_serde.name, + modified_time: trash_serde.modified_time, + create_time: trash_serde.create_time, + ty: trash_serde.ty, + } + } +} + +impl std::convert::From for TrashRevision { + fn from(trash: Trash) -> Self { + TrashRevision { + id: trash.id, + name: trash.name, + modified_time: trash.modified_time, + create_time: trash.create_time, + ty: trash.ty, + } + } +} diff --git a/shared-lib/flowy-folder-data-model/src/revision/view.rs b/shared-lib/flowy-folder-data-model/src/revision/view.rs new file mode 100644 index 0000000000..313ecf3013 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/revision/view.rs @@ -0,0 +1,93 @@ +use crate::entities::view::{View, ViewDataType}; +use crate::entities::RepeatedView; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct ViewRevision { + pub id: String, + + pub belong_to_id: String, + + pub name: String, + + pub desc: String, + + #[serde(default)] + pub data_type: ViewDataType, + + pub version: i64, + + pub belongings: Vec, + + pub modified_time: i64, + + pub create_time: i64, + + #[serde(default)] + pub ext_data: String, + + #[serde(default)] + pub thumbnail: String, + + #[serde(default = "default_plugin_type")] + pub plugin_type: i32, +} + +fn default_plugin_type() -> i32 { + 0 +} + +impl std::convert::From for View { + fn from(view_serde: ViewRevision) -> Self { + View { + id: view_serde.id, + belong_to_id: view_serde.belong_to_id, + name: view_serde.name, + desc: view_serde.desc, + data_type: view_serde.data_type, + version: view_serde.version, + belongings: view_serde.belongings.into(), + modified_time: view_serde.modified_time, + create_time: view_serde.create_time, + ext_data: view_serde.ext_data, + thumbnail: view_serde.thumbnail, + plugin_type: view_serde.plugin_type, + } + } +} + +impl std::convert::From for ViewRevision { + fn from(view: View) -> Self { + ViewRevision { + id: view.id, + belong_to_id: view.belong_to_id, + name: view.name, + desc: view.desc, + data_type: view.data_type, + version: view.version, + belongings: view.belongings.into(), + modified_time: view.modified_time, + create_time: view.create_time, + ext_data: view.ext_data, + thumbnail: view.thumbnail, + plugin_type: view.plugin_type, + } + } +} + +impl std::convert::From> for RepeatedView { + fn from(values: Vec) -> Self { + let items = values.into_iter().map(|value| value.into()).collect::>(); + RepeatedView { items } + } +} + +impl std::convert::From for Vec { + fn from(repeated_view: RepeatedView) -> Self { + repeated_view + .items + .into_iter() + .map(|value| value.into()) + .collect::>() + } +} diff --git a/shared-lib/flowy-folder-data-model/src/revision/workspace.rs b/shared-lib/flowy-folder-data-model/src/revision/workspace.rs new file mode 100644 index 0000000000..fb4fb974f6 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/revision/workspace.rs @@ -0,0 +1,44 @@ +use crate::entities::workspace::Workspace; +use crate::revision::AppRevision; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct WorkspaceRevision { + pub id: String, + + pub name: String, + + pub desc: String, + + pub apps: Vec, + + pub modified_time: i64, + + pub create_time: i64, +} + +impl std::convert::From for Workspace { + fn from(workspace_serde: WorkspaceRevision) -> Self { + Workspace { + id: workspace_serde.id, + name: workspace_serde.name, + desc: workspace_serde.desc, + apps: workspace_serde.apps.into(), + modified_time: workspace_serde.modified_time, + create_time: workspace_serde.create_time, + } + } +} + +impl std::convert::From for WorkspaceRevision { + fn from(workspace: Workspace) -> Self { + WorkspaceRevision { + id: workspace.id, + name: workspace.name, + desc: workspace.desc, + apps: workspace.apps.into(), + modified_time: workspace.modified_time, + create_time: workspace.create_time, + } + } +} diff --git a/shared-lib/flowy-sync/src/client_folder/builder.rs b/shared-lib/flowy-sync/src/client_folder/builder.rs index 9858600c6e..8dd82481a2 100644 --- a/shared-lib/flowy-sync/src/client_folder/builder.rs +++ b/shared-lib/flowy-sync/src/client_folder/builder.rs @@ -5,15 +5,17 @@ use crate::{ entities::revision::Revision, errors::{CollaborateError, CollaborateResult}, }; -use flowy_folder_data_model::entities::{trash::Trash, workspace::Workspace}; + +use flowy_folder_data_model::entities::{Trash, Workspace}; +use flowy_folder_data_model::revision::{TrashRevision, WorkspaceRevision}; use lib_ot::core::{PlainTextAttributes, PlainTextDelta, PlainTextDeltaBuilder}; use serde::{Deserialize, Serialize}; use std::sync::Arc; #[derive(Serialize, Deserialize)] pub(crate) struct FolderPadBuilder { - workspaces: Vec>, - trash: Vec>, + workspaces: Vec>, + trash: Vec>, } impl FolderPadBuilder { @@ -25,12 +27,15 @@ impl FolderPadBuilder { } pub(crate) fn with_workspace(mut self, workspaces: Vec) -> Self { - self.workspaces = workspaces.into_iter().map(Arc::new).collect::>(); + self.workspaces = workspaces + .into_iter() + .map(|workspace| Arc::new(workspace.into())) + .collect::>(); self } pub(crate) fn with_trash(mut self, trash: Vec) -> Self { - self.trash = trash.into_iter().map(Arc::new).collect::>(); + self.trash = trash.into_iter().map(|t| Arc::new(t.into())).collect::>(); self } diff --git a/shared-lib/flowy-sync/src/client_folder/folder_pad.rs b/shared-lib/flowy-sync/src/client_folder/folder_pad.rs index 1cb590eb52..4fbbfed723 100644 --- a/shared-lib/flowy-sync/src/client_folder/folder_pad.rs +++ b/shared-lib/flowy-sync/src/client_folder/folder_pad.rs @@ -1,3 +1,4 @@ +use crate::errors::internal_error; use crate::util::cal_diff; use crate::{ client_folder::builder::FolderPadBuilder, @@ -7,18 +8,17 @@ use crate::{ }, errors::{CollaborateError, CollaborateResult}, }; -use flowy_folder_data_model::entities::{app::App, trash::Trash, view::View, workspace::Workspace}; -use lib_ot::core::*; - -use crate::errors::internal_error; +use flowy_folder_data_model::entities::{App, Trash, View, Workspace}; +use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use lib_infra::util::move_vec_element; +use lib_ot::core::*; use serde::{Deserialize, Serialize}; use std::sync::Arc; #[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq)] pub struct FolderPad { - pub(crate) workspaces: Vec>, - pub(crate) trash: Vec>, + pub(crate) workspaces: Vec>, + pub(crate) trash: Vec>, #[serde(skip)] pub(crate) delta: FolderDelta, } @@ -63,7 +63,7 @@ impl FolderPad { #[tracing::instrument(level = "trace", skip(self, workspace), fields(workspace_name=%workspace.name), err)] pub fn create_workspace(&mut self, workspace: Workspace) -> CollaborateResult> { - let workspace = Arc::new(workspace); + let workspace = Arc::new(workspace.into()); if self.workspaces.contains(&workspace) { tracing::warn!("[RootFolder]: Duplicate workspace"); return Ok(None); @@ -99,13 +99,13 @@ impl FolderPad { let workspaces = self .workspaces .iter() - .map(|workspace| workspace.as_ref().clone()) + .map(|workspace| workspace.as_ref().clone().into()) .collect::>(); Ok(workspaces) } Some(workspace_id) => { if let Some(workspace) = self.workspaces.iter().find(|workspace| workspace.id == workspace_id) { - Ok(vec![workspace.as_ref().clone()]) + Ok(vec![workspace.as_ref().clone().into()]) } else { Err(CollaborateError::record_not_found() .context(format!("Can't find workspace with id {}", workspace_id))) @@ -125,12 +125,13 @@ impl FolderPad { #[tracing::instrument(level = "trace", skip(self), fields(app_name=%app.name), err)] pub fn create_app(&mut self, app: App) -> CollaborateResult> { let workspace_id = app.workspace_id.clone(); + let app_serde: AppRevision = app.into(); self.with_workspace(&workspace_id, move |workspace| { - if workspace.apps.contains(&app) { + if workspace.apps.contains(&app_serde) { tracing::warn!("[RootFolder]: Duplicate app"); return Ok(None); } - workspace.apps.push(app); + workspace.apps.push(app_serde); Ok(Some(())) }) } @@ -138,7 +139,7 @@ impl FolderPad { pub fn read_app(&self, app_id: &str) -> CollaborateResult { for workspace in &self.workspaces { if let Some(app) = workspace.apps.iter().find(|app| app.id == app_id) { - return Ok(app.clone()); + return Ok(app.clone().into()); } } Err(CollaborateError::record_not_found().context(format!("Can't find app with id {}", app_id))) @@ -185,12 +186,13 @@ impl FolderPad { #[tracing::instrument(level = "trace", skip(self), fields(view_name=%view.name), err)] pub fn create_view(&mut self, view: View) -> CollaborateResult> { let app_id = view.belong_to_id.clone(); + let view_serde: ViewRevision = view.into(); self.with_app(&app_id, move |app| { - if app.belongings.contains(&view) { + if app.belongings.contains(&view_serde) { tracing::warn!("[RootFolder]: Duplicate view"); return Ok(None); } - app.belongings.push(view); + app.belongings.push(view_serde); Ok(Some(())) }) } @@ -199,7 +201,7 @@ impl FolderPad { for workspace in &self.workspaces { for app in &(*workspace.apps) { if let Some(view) = app.belongings.iter().find(|b| b.id == view_id) { - return Ok(view.clone()); + return Ok(view.clone().into()); } } } @@ -210,7 +212,7 @@ impl FolderPad { for workspace in &self.workspaces { for app in &(*workspace.apps) { if app.id == belong_to_id { - return Ok(app.belongings.clone().take_items()); + return Ok(app.belongings.iter().map(|view| view.clone().into()).collect()); } } } @@ -261,7 +263,10 @@ impl FolderPad { pub fn create_trash(&mut self, trash: Vec) -> CollaborateResult> { self.with_trash(|t| { - let mut new_trash = trash.into_iter().map(Arc::new).collect::>>(); + let mut new_trash = trash + .into_iter() + .map(|t| Arc::new(t.into())) + .collect::>>(); t.append(&mut new_trash); Ok(Some(())) @@ -270,9 +275,13 @@ impl FolderPad { pub fn read_trash(&self, trash_id: Option) -> CollaborateResult> { match trash_id { - None => Ok(self.trash.iter().map(|t| t.as_ref().clone()).collect::>()), + None => Ok(self + .trash + .iter() + .map(|t| t.as_ref().clone().into()) + .collect::>()), Some(trash_id) => match self.trash.iter().find(|t| t.id == trash_id) { - Some(trash) => Ok(vec![trash.as_ref().clone()]), + Some(trash) => Ok(vec![trash.as_ref().clone().into()]), None => Ok(vec![]), }, } @@ -304,7 +313,7 @@ impl FolderPad { impl FolderPad { fn modify_workspaces(&mut self, f: F) -> CollaborateResult> where - F: FnOnce(&mut Vec>) -> CollaborateResult>, + F: FnOnce(&mut Vec>) -> CollaborateResult>, { let cloned_self = self.clone(); match f(&mut self.workspaces)? { @@ -325,7 +334,7 @@ impl FolderPad { fn with_workspace(&mut self, workspace_id: &str, f: F) -> CollaborateResult> where - F: FnOnce(&mut Workspace) -> CollaborateResult>, + F: FnOnce(&mut WorkspaceRevision) -> CollaborateResult>, { self.modify_workspaces(|workspaces| { if let Some(workspace) = workspaces.iter_mut().find(|workspace| workspace_id == workspace.id) { @@ -339,7 +348,7 @@ impl FolderPad { fn with_trash(&mut self, f: F) -> CollaborateResult> where - F: FnOnce(&mut Vec>) -> CollaborateResult>, + F: FnOnce(&mut Vec>) -> CollaborateResult>, { let cloned_self = self.clone(); match f(&mut self.trash)? { @@ -360,7 +369,7 @@ impl FolderPad { fn with_app(&mut self, app_id: &str, f: F) -> CollaborateResult> where - F: FnOnce(&mut App) -> CollaborateResult>, + F: FnOnce(&mut AppRevision) -> CollaborateResult>, { let workspace_id = match self .workspaces @@ -382,7 +391,7 @@ impl FolderPad { fn with_view(&mut self, belong_to_id: &str, view_id: &str, f: F) -> CollaborateResult> where - F: FnOnce(&mut View) -> CollaborateResult>, + F: FnOnce(&mut ViewRevision) -> CollaborateResult>, { self.with_app(belong_to_id, |app| { match app.belongings.iter_mut().find(|view| view_id == view.id) { diff --git a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs b/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs index 0e255f0f12..d0c2853fe6 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs @@ -25,12 +25,7 @@ pub trait JsonDeserializer { impl GridMetaPad { pub async fn duplicate_grid_meta(&self) -> (Vec, Vec) { - let fields = self - .grid_meta - .fields - .iter() - .map(|field| field.clone()) - .collect::>(); + let fields = self.grid_meta.fields.iter().cloned().collect::>(); let blocks = self .grid_meta From f8ec4b3e2403a1ebf246c62f24108f84eb5e2059 Mon Sep 17 00:00:00 2001 From: appflowy Date: Mon, 13 Jun 2022 20:59:46 +0800 Subject: [PATCH 05/11] refactor: replace object with object's revision entity --- .../workspace/application/view/view_ext.dart | 5 +- .../flowy-folder-data-model/view.pb.dart | 468 ++++- .../flowy-folder-data-model/view.pbjson.dart | 77 +- .../rust-lib/flowy-folder/src/event_map.rs | 27 +- frontend/rust-lib/flowy-folder/src/manager.rs | 13 +- .../src/services/app/controller.rs | 39 +- .../src/services/app/event_handler.rs | 16 +- .../src/services/persistence/migration.rs | 19 +- .../src/services/persistence/mod.rs | 30 +- .../services/persistence/version_1/app_sql.rs | 28 +- .../persistence/version_1/trash_sql.rs | 38 +- .../services/persistence/version_1/v1_impl.rs | 87 +- .../persistence/version_1/view_sql.rs | 40 +- .../persistence/version_1/workspace_sql.rs | 32 +- .../services/persistence/version_2/v2_impl.rs | 68 +- .../src/services/trash/controller.rs | 58 +- .../src/services/view/controller.rs | 120 +- .../src/services/view/event_handler.rs | 25 +- .../src/services/workspace/controller.rs | 42 +- .../src/services/workspace/event_handler.rs | 59 +- .../tests/workspace/folder_test.rs | 11 +- .../flowy-folder/tests/workspace/script.rs | 34 +- .../flowy-net/src/http_server/folder.rs | 180 +- .../flowy-net/src/local_server/server.rs | 53 +- frontend/rust-lib/flowy-test/src/helper.rs | 5 +- .../flowy-user/src/services/database.rs | 68 +- .../src/entities/app.rs | 2 +- .../src/entities/trash.rs | 28 +- .../src/entities/view.rs | 83 +- .../src/protobuf/model/view.rs | 1597 ++++++++++++++--- .../src/protobuf/proto/view.proto | 33 +- .../src/revision/app.rs | 35 +- .../src/revision/trash.rs | 31 +- .../src/revision/view.rs | 109 +- .../src/revision/workspace.rs | 15 +- .../src/user_default.rs | 32 +- .../flowy-sync/src/client_folder/builder.rs | 12 +- .../src/client_folder/folder_pad.rs | 128 +- .../src/client_grid/grid_meta_pad.rs | 2 +- 39 files changed, 2646 insertions(+), 1103 deletions(-) diff --git a/frontend/app_flowy/lib/workspace/application/view/view_ext.dart b/frontend/app_flowy/lib/workspace/application/view/view_ext.dart index 78230e1311..1fb36125e9 100644 --- a/frontend/app_flowy/lib/workspace/application/view/view_ext.dart +++ b/frontend/app_flowy/lib/workspace/application/view/view_ext.dart @@ -34,10 +34,7 @@ extension FlowyPluginExtension on FlowyPlugin { extension ViewExtension on View { Widget renderThumbnail({Color? iconColor}) { - String thumbnail = this.thumbnail; - if (thumbnail.isEmpty) { - thumbnail = "file_icon"; - } + String thumbnail = "file_icon"; final Widget widget = svgWidget(thumbnail, color: iconColor); return widget; diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart index 781a2fcdca..42d99339b7 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart @@ -19,15 +19,10 @@ class View extends $pb.GeneratedMessage { ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongToId') ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') - ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dataType', $pb.PbFieldType.OE, defaultOrMaker: ViewDataType.TextBlock, valueOf: ViewDataType.valueOf, enumValues: ViewDataType.values) - ..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'version') - ..aOM(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: RepeatedView.create) - ..aInt64(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'modifiedTime') - ..aInt64(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'createTime') - ..aOS(10, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'extData') - ..aOS(11, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'thumbnail') - ..a<$core.int>(12, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'pluginType', $pb.PbFieldType.O3) + ..e(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dataType', $pb.PbFieldType.OE, defaultOrMaker: ViewDataType.TextBlock, valueOf: ViewDataType.valueOf, enumValues: ViewDataType.values) + ..aInt64(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'modifiedTime') + ..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'createTime') + ..a<$core.int>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'pluginType', $pb.PbFieldType.O3) ..hasRequiredFields = false ; @@ -36,14 +31,9 @@ class View extends $pb.GeneratedMessage { $core.String? id, $core.String? belongToId, $core.String? name, - $core.String? desc, ViewDataType? dataType, - $fixnum.Int64? version, - RepeatedView? belongings, $fixnum.Int64? modifiedTime, $fixnum.Int64? createTime, - $core.String? extData, - $core.String? thumbnail, $core.int? pluginType, }) { final _result = create(); @@ -56,30 +46,15 @@ class View extends $pb.GeneratedMessage { if (name != null) { _result.name = name; } - if (desc != null) { - _result.desc = desc; - } if (dataType != null) { _result.dataType = dataType; } - if (version != null) { - _result.version = version; - } - if (belongings != null) { - _result.belongings = belongings; - } if (modifiedTime != null) { _result.modifiedTime = modifiedTime; } if (createTime != null) { _result.createTime = createTime; } - if (extData != null) { - _result.extData = extData; - } - if (thumbnail != null) { - _result.thumbnail = thumbnail; - } if (pluginType != null) { _result.pluginType = pluginType; } @@ -133,6 +108,137 @@ class View extends $pb.GeneratedMessage { @$pb.TagNumber(3) void clearName() => clearField(3); + @$pb.TagNumber(4) + ViewDataType get dataType => $_getN(3); + @$pb.TagNumber(4) + set dataType(ViewDataType v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasDataType() => $_has(3); + @$pb.TagNumber(4) + void clearDataType() => clearField(4); + + @$pb.TagNumber(5) + $fixnum.Int64 get modifiedTime => $_getI64(4); + @$pb.TagNumber(5) + set modifiedTime($fixnum.Int64 v) { $_setInt64(4, v); } + @$pb.TagNumber(5) + $core.bool hasModifiedTime() => $_has(4); + @$pb.TagNumber(5) + void clearModifiedTime() => clearField(5); + + @$pb.TagNumber(6) + $fixnum.Int64 get createTime => $_getI64(5); + @$pb.TagNumber(6) + set createTime($fixnum.Int64 v) { $_setInt64(5, v); } + @$pb.TagNumber(6) + $core.bool hasCreateTime() => $_has(5); + @$pb.TagNumber(6) + void clearCreateTime() => clearField(6); + + @$pb.TagNumber(7) + $core.int get pluginType => $_getIZ(6); + @$pb.TagNumber(7) + set pluginType($core.int v) { $_setSignedInt32(6, v); } + @$pb.TagNumber(7) + $core.bool hasPluginType() => $_has(6); + @$pb.TagNumber(7) + void clearPluginType() => clearField(7); +} + +class ViewInfo extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewInfo', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongToId') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') + ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') + ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dataType', $pb.PbFieldType.OE, defaultOrMaker: ViewDataType.TextBlock, valueOf: ViewDataType.valueOf, enumValues: ViewDataType.values) + ..aOM(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: RepeatedView.create) + ..aOM(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'extData', subBuilder: ViewExtData.create) + ..hasRequiredFields = false + ; + + ViewInfo._() : super(); + factory ViewInfo({ + $core.String? id, + $core.String? belongToId, + $core.String? name, + $core.String? desc, + ViewDataType? dataType, + RepeatedView? belongings, + ViewExtData? extData, + }) { + final _result = create(); + if (id != null) { + _result.id = id; + } + if (belongToId != null) { + _result.belongToId = belongToId; + } + if (name != null) { + _result.name = name; + } + if (desc != null) { + _result.desc = desc; + } + if (dataType != null) { + _result.dataType = dataType; + } + if (belongings != null) { + _result.belongings = belongings; + } + if (extData != null) { + _result.extData = extData; + } + return _result; + } + factory ViewInfo.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewInfo.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewInfo clone() => ViewInfo()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewInfo copyWith(void Function(ViewInfo) updates) => super.copyWith((message) => updates(message as ViewInfo)) as ViewInfo; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewInfo create() => ViewInfo._(); + ViewInfo createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewInfo getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewInfo? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get belongToId => $_getSZ(1); + @$pb.TagNumber(2) + set belongToId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasBelongToId() => $_has(1); + @$pb.TagNumber(2) + void clearBelongToId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + @$pb.TagNumber(4) $core.String get desc => $_getSZ(3); @$pb.TagNumber(4) @@ -152,69 +258,275 @@ class View extends $pb.GeneratedMessage { void clearDataType() => clearField(5); @$pb.TagNumber(6) - $fixnum.Int64 get version => $_getI64(5); + RepeatedView get belongings => $_getN(5); @$pb.TagNumber(6) - set version($fixnum.Int64 v) { $_setInt64(5, v); } + set belongings(RepeatedView v) { setField(6, v); } @$pb.TagNumber(6) - $core.bool hasVersion() => $_has(5); + $core.bool hasBelongings() => $_has(5); @$pb.TagNumber(6) - void clearVersion() => clearField(6); + void clearBelongings() => clearField(6); + @$pb.TagNumber(6) + RepeatedView ensureBelongings() => $_ensure(5); @$pb.TagNumber(7) - RepeatedView get belongings => $_getN(6); + ViewExtData get extData => $_getN(6); @$pb.TagNumber(7) - set belongings(RepeatedView v) { setField(7, v); } + set extData(ViewExtData v) { setField(7, v); } @$pb.TagNumber(7) - $core.bool hasBelongings() => $_has(6); + $core.bool hasExtData() => $_has(6); @$pb.TagNumber(7) - void clearBelongings() => clearField(7); + void clearExtData() => clearField(7); @$pb.TagNumber(7) - RepeatedView ensureBelongings() => $_ensure(6); + ViewExtData ensureExtData() => $_ensure(6); +} - @$pb.TagNumber(8) - $fixnum.Int64 get modifiedTime => $_getI64(7); - @$pb.TagNumber(8) - set modifiedTime($fixnum.Int64 v) { $_setInt64(7, v); } - @$pb.TagNumber(8) - $core.bool hasModifiedTime() => $_has(7); - @$pb.TagNumber(8) - void clearModifiedTime() => clearField(8); +class ViewExtData extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewExtData', createEmptyInstance: create) + ..aOM(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) + ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) + ..hasRequiredFields = false + ; - @$pb.TagNumber(9) - $fixnum.Int64 get createTime => $_getI64(8); - @$pb.TagNumber(9) - set createTime($fixnum.Int64 v) { $_setInt64(8, v); } - @$pb.TagNumber(9) - $core.bool hasCreateTime() => $_has(8); - @$pb.TagNumber(9) - void clearCreateTime() => clearField(9); + ViewExtData._() : super(); + factory ViewExtData({ + ViewFilter? filter, + ViewGroup? group, + ViewSort? sort, + }) { + final _result = create(); + if (filter != null) { + _result.filter = filter; + } + if (group != null) { + _result.group = group; + } + if (sort != null) { + _result.sort = sort; + } + return _result; + } + factory ViewExtData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewExtData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewExtData clone() => ViewExtData()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewExtData copyWith(void Function(ViewExtData) updates) => super.copyWith((message) => updates(message as ViewExtData)) as ViewExtData; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewExtData create() => ViewExtData._(); + ViewExtData createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewExtData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewExtData? _defaultInstance; - @$pb.TagNumber(10) - $core.String get extData => $_getSZ(9); - @$pb.TagNumber(10) - set extData($core.String v) { $_setString(9, v); } - @$pb.TagNumber(10) - $core.bool hasExtData() => $_has(9); - @$pb.TagNumber(10) - void clearExtData() => clearField(10); + @$pb.TagNumber(1) + ViewFilter get filter => $_getN(0); + @$pb.TagNumber(1) + set filter(ViewFilter v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasFilter() => $_has(0); + @$pb.TagNumber(1) + void clearFilter() => clearField(1); + @$pb.TagNumber(1) + ViewFilter ensureFilter() => $_ensure(0); - @$pb.TagNumber(11) - $core.String get thumbnail => $_getSZ(10); - @$pb.TagNumber(11) - set thumbnail($core.String v) { $_setString(10, v); } - @$pb.TagNumber(11) - $core.bool hasThumbnail() => $_has(10); - @$pb.TagNumber(11) - void clearThumbnail() => clearField(11); + @$pb.TagNumber(2) + ViewGroup get group => $_getN(1); + @$pb.TagNumber(2) + set group(ViewGroup v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasGroup() => $_has(1); + @$pb.TagNumber(2) + void clearGroup() => clearField(2); + @$pb.TagNumber(2) + ViewGroup ensureGroup() => $_ensure(1); - @$pb.TagNumber(12) - $core.int get pluginType => $_getIZ(11); - @$pb.TagNumber(12) - set pluginType($core.int v) { $_setSignedInt32(11, v); } - @$pb.TagNumber(12) - $core.bool hasPluginType() => $_has(11); - @$pb.TagNumber(12) - void clearPluginType() => clearField(12); + @$pb.TagNumber(3) + ViewSort get sort => $_getN(2); + @$pb.TagNumber(3) + set sort(ViewSort v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasSort() => $_has(2); + @$pb.TagNumber(3) + void clearSort() => clearField(3); + @$pb.TagNumber(3) + ViewSort ensureSort() => $_ensure(2); +} + +class ViewFilter extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewFilter', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..hasRequiredFields = false + ; + + ViewFilter._() : super(); + factory ViewFilter({ + $core.String? fieldId, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + return _result; + } + factory ViewFilter.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewFilter.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewFilter clone() => ViewFilter()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewFilter copyWith(void Function(ViewFilter) updates) => super.copyWith((message) => updates(message as ViewFilter)) as ViewFilter; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewFilter create() => ViewFilter._(); + ViewFilter createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewFilter getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewFilter? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); +} + +enum ViewGroup_OneOfSubGroupFieldId { + subGroupFieldId, + notSet +} + +class ViewGroup extends $pb.GeneratedMessage { + static const $core.Map<$core.int, ViewGroup_OneOfSubGroupFieldId> _ViewGroup_OneOfSubGroupFieldIdByTag = { + 2 : ViewGroup_OneOfSubGroupFieldId.subGroupFieldId, + 0 : ViewGroup_OneOfSubGroupFieldId.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewGroup', createEmptyInstance: create) + ..oo(0, [2]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'groupFieldId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subGroupFieldId') + ..hasRequiredFields = false + ; + + ViewGroup._() : super(); + factory ViewGroup({ + $core.String? groupFieldId, + $core.String? subGroupFieldId, + }) { + final _result = create(); + if (groupFieldId != null) { + _result.groupFieldId = groupFieldId; + } + if (subGroupFieldId != null) { + _result.subGroupFieldId = subGroupFieldId; + } + return _result; + } + factory ViewGroup.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewGroup.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewGroup clone() => ViewGroup()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewGroup copyWith(void Function(ViewGroup) updates) => super.copyWith((message) => updates(message as ViewGroup)) as ViewGroup; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewGroup create() => ViewGroup._(); + ViewGroup createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewGroup getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewGroup? _defaultInstance; + + ViewGroup_OneOfSubGroupFieldId whichOneOfSubGroupFieldId() => _ViewGroup_OneOfSubGroupFieldIdByTag[$_whichOneof(0)]!; + void clearOneOfSubGroupFieldId() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.String get groupFieldId => $_getSZ(0); + @$pb.TagNumber(1) + set groupFieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGroupFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearGroupFieldId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get subGroupFieldId => $_getSZ(1); + @$pb.TagNumber(2) + set subGroupFieldId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasSubGroupFieldId() => $_has(1); + @$pb.TagNumber(2) + void clearSubGroupFieldId() => clearField(2); +} + +class ViewSort extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewSort', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..hasRequiredFields = false + ; + + ViewSort._() : super(); + factory ViewSort({ + $core.String? fieldId, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + return _result; + } + factory ViewSort.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewSort.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewSort clone() => ViewSort()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewSort copyWith(void Function(ViewSort) updates) => super.copyWith((message) => updates(message as ViewSort)) as ViewSort; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewSort create() => ViewSort._(); + ViewSort createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewSort getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewSort? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); } class RepeatedView extends $pb.GeneratedMessage { diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart index fd2504389f..b83147e64e 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart @@ -37,20 +37,77 @@ const View$json = const { const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, const {'1': 'belong_to_id', '3': 2, '4': 1, '5': 9, '10': 'belongToId'}, const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, - const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'}, - const {'1': 'data_type', '3': 5, '4': 1, '5': 14, '6': '.ViewDataType', '10': 'dataType'}, - const {'1': 'version', '3': 6, '4': 1, '5': 3, '10': 'version'}, - const {'1': 'belongings', '3': 7, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'belongings'}, - const {'1': 'modified_time', '3': 8, '4': 1, '5': 3, '10': 'modifiedTime'}, - const {'1': 'create_time', '3': 9, '4': 1, '5': 3, '10': 'createTime'}, - const {'1': 'ext_data', '3': 10, '4': 1, '5': 9, '10': 'extData'}, - const {'1': 'thumbnail', '3': 11, '4': 1, '5': 9, '10': 'thumbnail'}, - const {'1': 'plugin_type', '3': 12, '4': 1, '5': 5, '10': 'pluginType'}, + const {'1': 'data_type', '3': 4, '4': 1, '5': 14, '6': '.ViewDataType', '10': 'dataType'}, + const {'1': 'modified_time', '3': 5, '4': 1, '5': 3, '10': 'modifiedTime'}, + const {'1': 'create_time', '3': 6, '4': 1, '5': 3, '10': 'createTime'}, + const {'1': 'plugin_type', '3': 7, '4': 1, '5': 5, '10': 'pluginType'}, ], }; /// Descriptor for `View`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewDescriptor = $convert.base64Decode('CgRWaWV3Eg4KAmlkGAEgASgJUgJpZBIgCgxiZWxvbmdfdG9faWQYAiABKAlSCmJlbG9uZ1RvSWQSEgoEbmFtZRgDIAEoCVIEbmFtZRISCgRkZXNjGAQgASgJUgRkZXNjEioKCWRhdGFfdHlwZRgFIAEoDjINLlZpZXdEYXRhVHlwZVIIZGF0YVR5cGUSGAoHdmVyc2lvbhgGIAEoA1IHdmVyc2lvbhItCgpiZWxvbmdpbmdzGAcgASgLMg0uUmVwZWF0ZWRWaWV3UgpiZWxvbmdpbmdzEiMKDW1vZGlmaWVkX3RpbWUYCCABKANSDG1vZGlmaWVkVGltZRIfCgtjcmVhdGVfdGltZRgJIAEoA1IKY3JlYXRlVGltZRIZCghleHRfZGF0YRgKIAEoCVIHZXh0RGF0YRIcCgl0aHVtYm5haWwYCyABKAlSCXRodW1ibmFpbBIfCgtwbHVnaW5fdHlwZRgMIAEoBVIKcGx1Z2luVHlwZQ=='); +final $typed_data.Uint8List viewDescriptor = $convert.base64Decode('CgRWaWV3Eg4KAmlkGAEgASgJUgJpZBIgCgxiZWxvbmdfdG9faWQYAiABKAlSCmJlbG9uZ1RvSWQSEgoEbmFtZRgDIAEoCVIEbmFtZRIqCglkYXRhX3R5cGUYBCABKA4yDS5WaWV3RGF0YVR5cGVSCGRhdGFUeXBlEiMKDW1vZGlmaWVkX3RpbWUYBSABKANSDG1vZGlmaWVkVGltZRIfCgtjcmVhdGVfdGltZRgGIAEoA1IKY3JlYXRlVGltZRIfCgtwbHVnaW5fdHlwZRgHIAEoBVIKcGx1Z2luVHlwZQ=='); +@$core.Deprecated('Use viewInfoDescriptor instead') +const ViewInfo$json = const { + '1': 'ViewInfo', + '2': const [ + const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + const {'1': 'belong_to_id', '3': 2, '4': 1, '5': 9, '10': 'belongToId'}, + const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'}, + const {'1': 'data_type', '3': 5, '4': 1, '5': 14, '6': '.ViewDataType', '10': 'dataType'}, + const {'1': 'belongings', '3': 6, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'belongings'}, + const {'1': 'ext_data', '3': 7, '4': 1, '5': 11, '6': '.ViewExtData', '10': 'extData'}, + ], +}; + +/// Descriptor for `ViewInfo`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewInfoDescriptor = $convert.base64Decode('CghWaWV3SW5mbxIOCgJpZBgBIAEoCVICaWQSIAoMYmVsb25nX3RvX2lkGAIgASgJUgpiZWxvbmdUb0lkEhIKBG5hbWUYAyABKAlSBG5hbWUSEgoEZGVzYxgEIAEoCVIEZGVzYxIqCglkYXRhX3R5cGUYBSABKA4yDS5WaWV3RGF0YVR5cGVSCGRhdGFUeXBlEi0KCmJlbG9uZ2luZ3MYBiABKAsyDS5SZXBlYXRlZFZpZXdSCmJlbG9uZ2luZ3MSJwoIZXh0X2RhdGEYByABKAsyDC5WaWV3RXh0RGF0YVIHZXh0RGF0YQ=='); +@$core.Deprecated('Use viewExtDataDescriptor instead') +const ViewExtData$json = const { + '1': 'ViewExtData', + '2': const [ + const {'1': 'filter', '3': 1, '4': 1, '5': 11, '6': '.ViewFilter', '10': 'filter'}, + const {'1': 'group', '3': 2, '4': 1, '5': 11, '6': '.ViewGroup', '10': 'group'}, + const {'1': 'sort', '3': 3, '4': 1, '5': 11, '6': '.ViewSort', '10': 'sort'}, + ], +}; + +/// Descriptor for `ViewExtData`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewExtDataDescriptor = $convert.base64Decode('CgtWaWV3RXh0RGF0YRIjCgZmaWx0ZXIYASABKAsyCy5WaWV3RmlsdGVyUgZmaWx0ZXISIAoFZ3JvdXAYAiABKAsyCi5WaWV3R3JvdXBSBWdyb3VwEh0KBHNvcnQYAyABKAsyCS5WaWV3U29ydFIEc29ydA=='); +@$core.Deprecated('Use viewFilterDescriptor instead') +const ViewFilter$json = const { + '1': 'ViewFilter', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + ], +}; + +/// Descriptor for `ViewFilter`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewFilterDescriptor = $convert.base64Decode('CgpWaWV3RmlsdGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElk'); +@$core.Deprecated('Use viewGroupDescriptor instead') +const ViewGroup$json = const { + '1': 'ViewGroup', + '2': const [ + const {'1': 'group_field_id', '3': 1, '4': 1, '5': 9, '10': 'groupFieldId'}, + const {'1': 'sub_group_field_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'subGroupFieldId'}, + ], + '8': const [ + const {'1': 'one_of_sub_group_field_id'}, + ], +}; + +/// Descriptor for `ViewGroup`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewGroupDescriptor = $convert.base64Decode('CglWaWV3R3JvdXASJAoOZ3JvdXBfZmllbGRfaWQYASABKAlSDGdyb3VwRmllbGRJZBItChJzdWJfZ3JvdXBfZmllbGRfaWQYAiABKAlIAFIPc3ViR3JvdXBGaWVsZElkQhsKGW9uZV9vZl9zdWJfZ3JvdXBfZmllbGRfaWQ='); +@$core.Deprecated('Use viewSortDescriptor instead') +const ViewSort$json = const { + '1': 'ViewSort', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + ], +}; + +/// Descriptor for `ViewSort`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewSortDescriptor = $convert.base64Decode('CghWaWV3U29ydBIZCghmaWVsZF9pZBgBIAEoCVIHZmllbGRJZA=='); @$core.Deprecated('Use repeatedViewDescriptor instead') const RepeatedView$json = const { '1': 'RepeatedView', diff --git a/frontend/rust-lib/flowy-folder/src/event_map.rs b/frontend/rust-lib/flowy-folder/src/event_map.rs index 22eb2c10d5..c9f1ebcd27 100644 --- a/frontend/rust-lib/flowy-folder/src/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/event_map.rs @@ -1,9 +1,9 @@ use crate::{ entities::{ - app::{App, AppId, CreateAppParams, UpdateAppParams}, - trash::{RepeatedTrash, RepeatedTrashId}, - view::{CreateViewParams, RepeatedViewId, UpdateViewParams, View, ViewId}, - workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceId}, + app::{AppId, CreateAppParams, UpdateAppParams}, + trash::RepeatedTrashId, + view::{CreateViewParams, RepeatedViewId, UpdateViewParams, ViewId}, + workspace::{CreateWorkspaceParams, UpdateWorkspaceParams, WorkspaceId}, }, errors::FlowyError, manager::FolderManager, @@ -11,6 +11,7 @@ use crate::{ }; use flowy_database::{ConnectionPool, DBConnection}; use flowy_derive::{Flowy_Event, ProtoBuf_Enum}; +use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use lib_dispatch::prelude::*; use lib_infra::future::FutureResult; use std::sync::Arc; @@ -155,27 +156,31 @@ pub trait FolderCouldServiceV1: Send + Sync { fn init(&self); // Workspace - fn create_workspace(&self, token: &str, params: CreateWorkspaceParams) -> FutureResult; + fn create_workspace( + &self, + token: &str, + params: CreateWorkspaceParams, + ) -> FutureResult; - fn read_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult; + fn read_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult, FlowyError>; fn update_workspace(&self, token: &str, params: UpdateWorkspaceParams) -> FutureResult<(), FlowyError>; fn delete_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult<(), FlowyError>; // View - fn create_view(&self, token: &str, params: CreateViewParams) -> FutureResult; + fn create_view(&self, token: &str, params: CreateViewParams) -> FutureResult; - fn read_view(&self, token: &str, params: ViewId) -> FutureResult, FlowyError>; + fn read_view(&self, token: &str, params: ViewId) -> FutureResult, FlowyError>; fn delete_view(&self, token: &str, params: RepeatedViewId) -> FutureResult<(), FlowyError>; fn update_view(&self, token: &str, params: UpdateViewParams) -> FutureResult<(), FlowyError>; // App - fn create_app(&self, token: &str, params: CreateAppParams) -> FutureResult; + fn create_app(&self, token: &str, params: CreateAppParams) -> FutureResult; - fn read_app(&self, token: &str, params: AppId) -> FutureResult, FlowyError>; + fn read_app(&self, token: &str, params: AppId) -> FutureResult, FlowyError>; fn update_app(&self, token: &str, params: UpdateAppParams) -> FutureResult<(), FlowyError>; @@ -186,5 +191,5 @@ pub trait FolderCouldServiceV1: Send + Sync { fn delete_trash(&self, token: &str, params: RepeatedTrashId) -> FutureResult<(), FlowyError>; - fn read_trash(&self, token: &str) -> FutureResult; + fn read_trash(&self, token: &str) -> FutureResult, FlowyError>; } diff --git a/frontend/rust-lib/flowy-folder/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rs index 3181c14625..d9664004c9 100644 --- a/frontend/rust-lib/flowy-folder/src/manager.rs +++ b/frontend/rust-lib/flowy-folder/src/manager.rs @@ -13,6 +13,7 @@ use flowy_sync::client_document::default::{initial_quill_delta_string, initial_r use flowy_error::FlowyError; use flowy_folder_data_model::entities::view::ViewDataType; + use flowy_folder_data_model::user_default; use flowy_revision::disk::SQLiteTextBlockRevisionPersistence; use flowy_revision::{RevisionManager, RevisionPersistence, RevisionWebSocket}; @@ -199,9 +200,9 @@ impl DefaultFolderBuilder { view_controller: Arc, ) -> FlowyResult<()> { log::debug!("Create user default workspace"); - let workspace = user_default::create_default_workspace(); - set_current_workspace(&workspace.id); - for app in workspace.apps.iter() { + let workspace_rev = user_default::create_default_workspace(); + set_current_workspace(&workspace_rev.id); + for app in workspace_rev.apps.iter() { for (index, view) in app.belongings.iter().enumerate() { let view_data = if index == 0 { initial_read_me().to_delta_str() @@ -214,10 +215,12 @@ impl DefaultFolderBuilder { .await?; } } - let folder = FolderPad::new(vec![workspace.clone()], vec![])?; + let folder = FolderPad::new(vec![workspace_rev.clone()], vec![])?; let folder_id = FolderId::new(user_id); let _ = persistence.save_folder(user_id, &folder_id, folder).await?; - let repeated_workspace = RepeatedWorkspace { items: vec![workspace] }; + let repeated_workspace = RepeatedWorkspace { + items: vec![workspace_rev.into()], + }; send_dart_notification(token, FolderNotification::UserCreateWorkspace) .payload(repeated_workspace) .send(); diff --git a/frontend/rust-lib/flowy-folder/src/services/app/controller.rs b/frontend/rust-lib/flowy-folder/src/services/app/controller.rs index d33f40b4c6..481af85ccd 100644 --- a/frontend/rust-lib/flowy-folder/src/services/app/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/app/controller.rs @@ -12,6 +12,7 @@ use crate::{ }, }; +use flowy_folder_data_model::revision::AppRevision; use futures::{FutureExt, StreamExt}; use std::{collections::HashSet, sync::Arc}; @@ -48,7 +49,7 @@ impl AppController { self.create_app_on_local(app).await } - pub(crate) async fn create_app_on_local(&self, app: App) -> Result { + pub(crate) async fn create_app_on_local(&self, app: AppRevision) -> Result { let _ = self .persistence .begin_transaction(|transaction| { @@ -57,10 +58,10 @@ impl AppController { Ok(()) }) .await?; - Ok(app) + Ok(app.into()) } - pub(crate) async fn read_app(&self, params: AppId) -> Result { + pub(crate) async fn read_app(&self, params: AppId) -> Result { let app = self .persistence .begin_transaction(|transaction| { @@ -80,14 +81,15 @@ impl AppController { let changeset = AppChangeset::new(params.clone()); let app_id = changeset.id.clone(); - let app = self + let app: App = self .persistence .begin_transaction(|transaction| { let _ = transaction.update_app(changeset)?; let app = transaction.read_app(&app_id)?; Ok(app) }) - .await?; + .await? + .into(); send_dart_notification(&app_id, FolderNotification::AppUpdated) .payload(app) .send(); @@ -108,8 +110,8 @@ impl AppController { Ok(()) } - pub(crate) async fn read_local_apps(&self, ids: Vec) -> Result, FlowyError> { - let apps = self + pub(crate) async fn read_local_apps(&self, ids: Vec) -> Result, FlowyError> { + let app_revs = self .persistence .begin_transaction(|transaction| { let mut apps = vec![]; @@ -119,13 +121,13 @@ impl AppController { Ok(apps) }) .await?; - Ok(apps) + Ok(app_revs) } } impl AppController { #[tracing::instrument(level = "trace", skip(self), err)] - async fn create_app_on_server(&self, params: CreateAppParams) -> Result { + async fn create_app_on_server(&self, params: CreateAppParams) -> Result { let token = self.user.token()?; let app = self.cloud_service.create_app(&token, params).await?; Ok(app) @@ -154,12 +156,13 @@ impl AppController { let persistence = self.persistence.clone(); tokio::spawn(async move { match server.read_app(&token, params).await { - Ok(Some(app)) => { + Ok(Some(app_rev)) => { match persistence - .begin_transaction(|transaction| transaction.create_app(app.clone())) + .begin_transaction(|transaction| transaction.create_app(app_rev.clone())) .await { Ok(_) => { + let app: App = app_rev.into(); send_dart_notification(&app.id, FolderNotification::AppUpdated) .payload(app) .send(); @@ -240,7 +243,11 @@ fn notify_apps_changed<'a>( trash_controller: Arc, transaction: &'a (dyn FolderPersistenceTransaction + 'a), ) -> FlowyResult<()> { - let repeated_app = read_local_workspace_apps(workspace_id, trash_controller, transaction)?; + let items = read_local_workspace_apps(workspace_id, trash_controller, transaction)? + .into_iter() + .map(|app_rev| app_rev.into()) + .collect(); + let repeated_app = RepeatedApp { items }; send_dart_notification(workspace_id, FolderNotification::WorkspaceAppsChanged) .payload(repeated_app) .send(); @@ -251,9 +258,9 @@ pub fn read_local_workspace_apps<'a>( workspace_id: &str, trash_controller: Arc, transaction: &'a (dyn FolderPersistenceTransaction + 'a), -) -> Result { - let mut apps = transaction.read_workspace_apps(workspace_id)?; +) -> Result, FlowyError> { + let mut app_revs = transaction.read_workspace_apps(workspace_id)?; let trash_ids = trash_controller.read_trash_ids(transaction)?; - apps.retain(|app| !trash_ids.contains(&app.id)); - Ok(RepeatedApp { items: apps }) + app_revs.retain(|app| !trash_ids.contains(&app.id)); + Ok(app_revs) } diff --git a/frontend/rust-lib/flowy-folder/src/services/app/event_handler.rs b/frontend/rust-lib/flowy-folder/src/services/app/event_handler.rs index b95b91dc2e..28885c69d7 100644 --- a/frontend/rust-lib/flowy-folder/src/services/app/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/services/app/event_handler.rs @@ -1,11 +1,9 @@ use crate::{ - entities::{ - app::{App, AppId, CreateAppParams, CreateAppPayload, UpdateAppParams, UpdateAppPayload}, - trash::Trash, - }, + entities::app::{App, AppId, CreateAppParams, CreateAppPayload, UpdateAppParams, UpdateAppPayload}, errors::FlowyError, services::{AppController, TrashController, ViewController}, }; +use flowy_folder_data_model::revision::TrashRevision; use lib_dispatch::prelude::{data_result, AppData, Data, DataResult}; use std::{convert::TryInto, sync::Arc}; @@ -29,8 +27,8 @@ pub(crate) async fn delete_app_handler( .read_local_apps(vec![params.value]) .await? .into_iter() - .map(|app| app.into()) - .collect::>(); + .map(|app_rev| app_rev.into()) + .collect::>(); let _ = trash_controller.add(trash).await?; Ok(()) @@ -53,8 +51,8 @@ pub(crate) async fn read_app_handler( view_controller: AppData>, ) -> DataResult { let params: AppId = data.into_inner(); - let mut app = app_controller.read_app(params.clone()).await?; - app.belongings = view_controller.read_views_belong_to(¶ms.value).await?; + let mut app_rev = app_controller.read_app(params.clone()).await?; + app_rev.belongings = view_controller.read_views_belong_to(¶ms.value).await?; - data_result(app) + data_result(app_rev.into()) } diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/migration.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/migration.rs index bc8838059a..4c147ad0d4 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/migration.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/migration.rs @@ -5,11 +5,8 @@ use crate::{ }; use flowy_database::kv::KV; use flowy_error::{FlowyError, FlowyResult}; -use flowy_folder_data_model::entities::{ - app::{App, RepeatedApp}, - view::{RepeatedView, View}, - workspace::Workspace, -}; + +use flowy_folder_data_model::revision::{AppRevision, ViewRevision, WorkspaceRevision}; use flowy_revision::disk::SQLiteTextBlockRevisionPersistence; use flowy_revision::{RevisionLoader, RevisionPersistence}; use flowy_sync::{client_folder::FolderPad, entities::revision::md5}; @@ -42,25 +39,25 @@ impl FolderMigration { let workspaces = conn.immediate_transaction::<_, FlowyError, _>(|| { let mut workspaces = WorkspaceTableSql::read_workspaces(&self.user_id, None, conn)? .into_iter() - .map(Workspace::from) + .map(WorkspaceRevision::from) .collect::>(); for workspace in workspaces.iter_mut() { let mut apps = AppTableSql::read_workspace_apps(&workspace.id, conn)? .into_iter() - .map(App::from) + .map(AppRevision::from) .collect::>(); for app in apps.iter_mut() { let views = ViewTableSql::read_views(&app.id, conn)? .into_iter() - .map(View::from) + .map(ViewRevision::from) .collect::>(); - app.belongings = RepeatedView { items: views }; + app.belongings = views; } - workspace.apps = RepeatedApp { items: apps }; + workspace.apps = apps; } Ok(workspaces) })?; @@ -72,7 +69,7 @@ impl FolderMigration { } let trash = conn.immediate_transaction::<_, FlowyError, _>(|| { - let trash = TrashTableSql::read_all(conn)?.take_items(); + let trash = TrashTableSql::read_all(conn)?; Ok(trash) })?; diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs index d5bbb3a277..81aaa9bda6 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs @@ -9,12 +9,8 @@ use crate::{ }; use flowy_database::ConnectionPool; use flowy_error::{FlowyError, FlowyResult}; -use flowy_folder_data_model::entities::{ - app::App, - trash::{RepeatedTrash, Trash}, - view::View, - workspace::Workspace, -}; + +use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use flowy_revision::disk::{RevisionRecord, RevisionState}; use flowy_revision::mk_revision_disk_cache; use flowy_sync::client_folder::initial_folder_delta; @@ -24,27 +20,27 @@ use tokio::sync::RwLock; pub use version_1::{app_sql::*, trash_sql::*, v1_impl::V1Transaction, view_sql::*, workspace_sql::*}; pub trait FolderPersistenceTransaction { - fn create_workspace(&self, user_id: &str, workspace: Workspace) -> FlowyResult<()>; - fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult>; + fn create_workspace(&self, user_id: &str, workspace_rev: WorkspaceRevision) -> FlowyResult<()>; + fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult>; fn update_workspace(&self, changeset: WorkspaceChangeset) -> FlowyResult<()>; fn delete_workspace(&self, workspace_id: &str) -> FlowyResult<()>; - fn create_app(&self, app: App) -> FlowyResult<()>; + fn create_app(&self, app_rev: AppRevision) -> FlowyResult<()>; fn update_app(&self, changeset: AppChangeset) -> FlowyResult<()>; - fn read_app(&self, app_id: &str) -> FlowyResult; - fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult>; - fn delete_app(&self, app_id: &str) -> FlowyResult; + fn read_app(&self, app_id: &str) -> FlowyResult; + fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult>; + fn delete_app(&self, app_id: &str) -> FlowyResult; fn move_app(&self, app_id: &str, from: usize, to: usize) -> FlowyResult<()>; - fn create_view(&self, view: View) -> FlowyResult<()>; - fn read_view(&self, view_id: &str) -> FlowyResult; - fn read_views(&self, belong_to_id: &str) -> FlowyResult>; + fn create_view(&self, view_rev: ViewRevision) -> FlowyResult<()>; + fn read_view(&self, view_id: &str) -> FlowyResult; + fn read_views(&self, belong_to_id: &str) -> FlowyResult>; fn update_view(&self, changeset: ViewChangeset) -> FlowyResult<()>; fn delete_view(&self, view_id: &str) -> FlowyResult<()>; fn move_view(&self, view_id: &str, from: usize, to: usize) -> FlowyResult<()>; - fn create_trash(&self, trashes: Vec) -> FlowyResult<()>; - fn read_trash(&self, trash_id: Option) -> FlowyResult; + fn create_trash(&self, trashes: Vec) -> FlowyResult<()>; + fn read_trash(&self, trash_id: Option) -> FlowyResult>; fn delete_trash(&self, trash_ids: Option>) -> FlowyResult<()>; } diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/app_sql.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/app_sql.rs index 46f351ff03..6b5f47c2b7 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/app_sql.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/app_sql.rs @@ -1,7 +1,6 @@ use crate::entities::{ - app::{App, UpdateAppParams}, + app::UpdateAppParams, trash::{Trash, TrashType}, - view::RepeatedView, }; use crate::{errors::FlowyError, services::persistence::version_1::workspace_sql::WorkspaceTable}; use flowy_database::{ @@ -9,11 +8,12 @@ use flowy_database::{ schema::{app_table, app_table::dsl}, SqliteConnection, }; +use flowy_folder_data_model::revision::AppRevision; pub struct AppTableSql(); impl AppTableSql { - pub(crate) fn create_app(app: App, conn: &SqliteConnection) -> Result<(), FlowyError> { - let app_table = AppTable::new(app); + pub(crate) fn create_app(app_rev: AppRevision, conn: &SqliteConnection) -> Result<(), FlowyError> { + let app_table = AppTable::new(app_rev); match diesel_record_count!(app_table, &app_table.id, conn) { 0 => diesel_insert_table!(app_table, &app_table, conn), _ => { @@ -91,16 +91,16 @@ pub(crate) struct AppTable { } impl AppTable { - pub fn new(app: App) -> Self { + pub fn new(app_rev: AppRevision) -> Self { Self { - id: app.id, - workspace_id: app.workspace_id, - name: app.name, - desc: app.desc, + id: app_rev.id, + workspace_id: app_rev.workspace_id, + name: app_rev.name, + desc: app_rev.desc, color_style: Default::default(), last_view_id: None, - modified_time: app.modified_time, - create_time: app.create_time, + modified_time: app_rev.modified_time, + create_time: app_rev.create_time, version: 0, is_trash: false, } @@ -147,14 +147,14 @@ impl AppChangeset { } } } -impl std::convert::From for App { +impl std::convert::From for AppRevision { fn from(table: AppTable) -> Self { - App { + AppRevision { id: table.id, workspace_id: table.workspace_id, name: table.name, desc: table.desc, - belongings: RepeatedView::default(), + belongings: vec![], version: table.version, modified_time: table.modified_time, create_time: table.create_time, diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/trash_sql.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/trash_sql.rs index 14bdce0d10..c4f6fff365 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/trash_sql.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/trash_sql.rs @@ -1,5 +1,5 @@ use crate::{ - entities::trash::{RepeatedTrash, Trash, TrashType}, + entities::trash::{Trash, TrashType}, errors::FlowyError, }; use diesel::sql_types::Integer; @@ -8,12 +8,13 @@ use flowy_database::{ schema::{trash_table, trash_table::dsl}, SqliteConnection, }; +use flowy_folder_data_model::revision::TrashRevision; pub struct TrashTableSql(); impl TrashTableSql { - pub(crate) fn create_trash(trashes: Vec, conn: &SqliteConnection) -> Result<(), FlowyError> { - for trash in trashes { - let trash_table: TrashTable = trash.into(); + pub(crate) fn create_trash(trashes: Vec, conn: &SqliteConnection) -> Result<(), FlowyError> { + for trash_rev in trashes { + let trash_table: TrashTable = trash_rev.into(); match diesel_record_count!(trash_table, &trash_table.id, conn) { 0 => diesel_insert_table!(trash_table, &trash_table, conn), _ => { @@ -26,10 +27,13 @@ impl TrashTableSql { Ok(()) } - pub(crate) fn read_all(conn: &SqliteConnection) -> Result { + pub(crate) fn read_all(conn: &SqliteConnection) -> Result, FlowyError> { let trash_tables = dsl::trash_table.load::(conn)?; - let items = trash_tables.into_iter().map(|t| t.into()).collect::>(); - Ok(RepeatedTrash { items }) + let items = trash_tables + .into_iter() + .map(TrashRevision::from) + .collect::>(); + Ok(items) } pub(crate) fn delete_all(conn: &SqliteConnection) -> Result<(), FlowyError> { @@ -72,12 +76,11 @@ impl std::convert::From for Trash { } } -impl std::convert::From for TrashTable { - fn from(trash: Trash) -> Self { - TrashTable { +impl std::convert::From for TrashRevision { + fn from(trash: TrashTable) -> Self { + TrashRevision { id: trash.id, name: trash.name, - desc: "".to_owned(), modified_time: trash.modified_time, create_time: trash.create_time, ty: trash.ty.into(), @@ -85,6 +88,19 @@ impl std::convert::From for TrashTable { } } +impl std::convert::From for TrashTable { + fn from(trash_rev: TrashRevision) -> Self { + TrashTable { + id: trash_rev.id, + name: trash_rev.name, + desc: "".to_string(), + modified_time: trash_rev.modified_time, + create_time: trash_rev.create_time, + ty: trash_rev.ty.into(), + } + } +} + #[derive(AsChangeset, Identifiable, Clone, Default, Debug)] #[table_name = "trash_table"] pub(crate) struct TrashChangeset { diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs index 4f5a2d181d..619aa156ca 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs @@ -8,24 +8,19 @@ use crate::services::persistence::{ }; use flowy_database::DBConnection; use flowy_error::FlowyResult; -use flowy_folder_data_model::entities::{ - app::App, - trash::{RepeatedTrash, Trash}, - view::View, - workspace::Workspace, -}; +use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; pub struct V1Transaction<'a>(pub &'a DBConnection); impl<'a> FolderPersistenceTransaction for V1Transaction<'a> { - fn create_workspace(&self, user_id: &str, workspace: Workspace) -> FlowyResult<()> { - let _ = WorkspaceTableSql::create_workspace(user_id, workspace, &*self.0)?; + fn create_workspace(&self, user_id: &str, workspace_rev: WorkspaceRevision) -> FlowyResult<()> { + let _ = WorkspaceTableSql::create_workspace(user_id, workspace_rev, &*self.0)?; Ok(()) } - fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult> { + fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult> { let tables = WorkspaceTableSql::read_workspaces(user_id, workspace_id, &*self.0)?; - let workspaces = tables.into_iter().map(Workspace::from).collect::>(); + let workspaces = tables.into_iter().map(WorkspaceRevision::from).collect::>(); Ok(workspaces) } @@ -37,8 +32,8 @@ impl<'a> FolderPersistenceTransaction for V1Transaction<'a> { WorkspaceTableSql::delete_workspace(workspace_id, &*self.0) } - fn create_app(&self, app: App) -> FlowyResult<()> { - let _ = AppTableSql::create_app(app, &*self.0)?; + fn create_app(&self, app_rev: AppRevision) -> FlowyResult<()> { + let _ = AppTableSql::create_app(app_rev, &*self.0)?; Ok(()) } @@ -47,39 +42,39 @@ impl<'a> FolderPersistenceTransaction for V1Transaction<'a> { Ok(()) } - fn read_app(&self, app_id: &str) -> FlowyResult { - let table = AppTableSql::read_app(app_id, &*self.0)?; - Ok(App::from(table)) + fn read_app(&self, app_id: &str) -> FlowyResult { + let app_revision: AppRevision = AppTableSql::read_app(app_id, &*self.0)?.into(); + Ok(app_revision) } - fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { + fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { let tables = AppTableSql::read_workspace_apps(workspace_id, &*self.0)?; - let apps = tables.into_iter().map(App::from).collect::>(); + let apps = tables.into_iter().map(AppRevision::from).collect::>(); Ok(apps) } - fn delete_app(&self, app_id: &str) -> FlowyResult { - let table = AppTableSql::delete_app(app_id, &*self.0)?; - Ok(App::from(table)) + fn delete_app(&self, app_id: &str) -> FlowyResult { + let app_revision: AppRevision = AppTableSql::delete_app(app_id, &*self.0)?.into(); + Ok(app_revision) } fn move_app(&self, _app_id: &str, _from: usize, _to: usize) -> FlowyResult<()> { Ok(()) } - fn create_view(&self, view: View) -> FlowyResult<()> { - let _ = ViewTableSql::create_view(view, &*self.0)?; + fn create_view(&self, view_rev: ViewRevision) -> FlowyResult<()> { + let _ = ViewTableSql::create_view(view_rev, &*self.0)?; Ok(()) } - fn read_view(&self, view_id: &str) -> FlowyResult { - let table = ViewTableSql::read_view(view_id, &*self.0)?; - Ok(View::from(table)) + fn read_view(&self, view_id: &str) -> FlowyResult { + let view_revision: ViewRevision = ViewTableSql::read_view(view_id, &*self.0)?.into(); + Ok(view_revision) } - fn read_views(&self, belong_to_id: &str) -> FlowyResult> { + fn read_views(&self, belong_to_id: &str) -> FlowyResult> { let tables = ViewTableSql::read_views(belong_to_id, &*self.0)?; - let views = tables.into_iter().map(View::from).collect::>(); + let views = tables.into_iter().map(ViewRevision::from).collect::>(); Ok(views) } @@ -97,19 +92,17 @@ impl<'a> FolderPersistenceTransaction for V1Transaction<'a> { Ok(()) } - fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { + fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { let _ = TrashTableSql::create_trash(trashes, &*self.0)?; Ok(()) } - fn read_trash(&self, trash_id: Option) -> FlowyResult { + fn read_trash(&self, trash_id: Option) -> FlowyResult> { match trash_id { None => TrashTableSql::read_all(&*self.0), Some(trash_id) => { - let table = TrashTableSql::read(&trash_id, &*self.0)?; - Ok(RepeatedTrash { - items: vec![Trash::from(table)], - }) + let trash_revision: TrashRevision = TrashTableSql::read(&trash_id, &*self.0)?.into(); + Ok(vec![trash_revision]) } } } @@ -132,11 +125,11 @@ impl FolderPersistenceTransaction for Box where T: FolderPersistenceTransaction + ?Sized, { - fn create_workspace(&self, user_id: &str, workspace: Workspace) -> FlowyResult<()> { - (**self).create_workspace(user_id, workspace) + fn create_workspace(&self, user_id: &str, workspace_rev: WorkspaceRevision) -> FlowyResult<()> { + (**self).create_workspace(user_id, workspace_rev) } - fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult> { + fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult> { (**self).read_workspaces(user_id, workspace_id) } @@ -148,23 +141,23 @@ where (**self).delete_workspace(workspace_id) } - fn create_app(&self, app: App) -> FlowyResult<()> { - (**self).create_app(app) + fn create_app(&self, app_rev: AppRevision) -> FlowyResult<()> { + (**self).create_app(app_rev) } fn update_app(&self, changeset: AppChangeset) -> FlowyResult<()> { (**self).update_app(changeset) } - fn read_app(&self, app_id: &str) -> FlowyResult { + fn read_app(&self, app_id: &str) -> FlowyResult { (**self).read_app(app_id) } - fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { + fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { (**self).read_workspace_apps(workspace_id) } - fn delete_app(&self, app_id: &str) -> FlowyResult { + fn delete_app(&self, app_id: &str) -> FlowyResult { (**self).delete_app(app_id) } @@ -172,15 +165,15 @@ where Ok(()) } - fn create_view(&self, view: View) -> FlowyResult<()> { - (**self).create_view(view) + fn create_view(&self, view_rev: ViewRevision) -> FlowyResult<()> { + (**self).create_view(view_rev) } - fn read_view(&self, view_id: &str) -> FlowyResult { + fn read_view(&self, view_id: &str) -> FlowyResult { (**self).read_view(view_id) } - fn read_views(&self, belong_to_id: &str) -> FlowyResult> { + fn read_views(&self, belong_to_id: &str) -> FlowyResult> { (**self).read_views(belong_to_id) } @@ -196,11 +189,11 @@ where Ok(()) } - fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { + fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { (**self).create_trash(trashes) } - fn read_trash(&self, trash_id: Option) -> FlowyResult { + fn read_trash(&self, trash_id: Option) -> FlowyResult> { (**self).read_trash(trash_id) } diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs index 0677110cda..08c96ac90c 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/view_sql.rs @@ -1,7 +1,7 @@ use crate::{ entities::{ trash::{Trash, TrashType}, - view::{RepeatedView, UpdateViewParams, View, ViewDataType}, + view::{UpdateViewParams, ViewDataType}, }, errors::FlowyError, services::persistence::version_1::app_sql::AppTable, @@ -12,12 +12,14 @@ use flowy_database::{ schema::{view_table, view_table::dsl}, SqliteConnection, }; + +use flowy_folder_data_model::revision::ViewRevision; use lib_infra::util::timestamp; pub struct ViewTableSql(); impl ViewTableSql { - pub(crate) fn create_view(view: View, conn: &SqliteConnection) -> Result<(), FlowyError> { - let view_table = ViewTable::new(view); + pub(crate) fn create_view(view_rev: ViewRevision, conn: &SqliteConnection) -> Result<(), FlowyError> { + let view_table = ViewTable::new(view_rev); match diesel_record_count!(view_table, &view_table.id, conn) { 0 => diesel_insert_table!(view_table, &view_table, conn), _ => { @@ -83,49 +85,49 @@ pub(crate) struct ViewTable { } impl ViewTable { - pub fn new(view: View) -> Self { - let data_type = match view.data_type { + pub fn new(view_rev: ViewRevision) -> Self { + let data_type = match view_rev.data_type { ViewDataType::TextBlock => SqlViewDataType::Block, ViewDataType::Grid => SqlViewDataType::Grid, }; ViewTable { - id: view.id, - belong_to_id: view.belong_to_id, - name: view.name, - desc: view.desc, - modified_time: view.modified_time, - create_time: view.create_time, - thumbnail: view.thumbnail, + id: view_rev.id, + belong_to_id: view_rev.belong_to_id, + name: view_rev.name, + desc: view_rev.desc, + modified_time: view_rev.modified_time, + create_time: view_rev.create_time, + thumbnail: view_rev.thumbnail, view_type: data_type, - ext_data: view.ext_data, - version: 0, + ext_data: view_rev.ext_data, + version: view_rev.version, is_trash: false, } } } -impl std::convert::From for View { +impl std::convert::From for ViewRevision { fn from(table: ViewTable) -> Self { let data_type = match table.view_type { SqlViewDataType::Block => ViewDataType::TextBlock, SqlViewDataType::Grid => ViewDataType::Grid, }; - View { + ViewRevision { id: table.id, belong_to_id: table.belong_to_id, name: table.name, desc: table.desc, data_type, - belongings: RepeatedView::default(), + belongings: vec![], modified_time: table.modified_time, version: table.version, create_time: table.create_time, - ext_data: table.ext_data, + ext_data: "".to_string(), thumbnail: table.thumbnail, // Store the view in ViewTable was deprecated since v0.0.2. - // No need worry about plugin_type. + // No need to worry about plugin_type. plugin_type: 0, } } diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/workspace_sql.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/workspace_sql.rs index ce95d09275..4de8f7df34 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/workspace_sql.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/workspace_sql.rs @@ -1,23 +1,19 @@ -use crate::{ - entities::{ - app::RepeatedApp, - workspace::{UpdateWorkspaceParams, Workspace}, - }, - errors::FlowyError, -}; +use crate::{entities::workspace::UpdateWorkspaceParams, errors::FlowyError}; use diesel::SqliteConnection; use flowy_database::{ prelude::*, schema::{workspace_table, workspace_table::dsl}, }; +use flowy_folder_data_model::revision::WorkspaceRevision; + pub(crate) struct WorkspaceTableSql(); impl WorkspaceTableSql { pub(crate) fn create_workspace( user_id: &str, - workspace: Workspace, + workspace_rev: WorkspaceRevision, conn: &SqliteConnection, ) -> Result<(), FlowyError> { - let table = WorkspaceTable::new(workspace, user_id); + let table = WorkspaceTable::new(workspace_rev, user_id); match diesel_record_count!(workspace_table, &table.id, conn) { 0 => diesel_insert_table!(workspace_table, &table, conn), _ => { @@ -74,26 +70,26 @@ pub struct WorkspaceTable { impl WorkspaceTable { #[allow(dead_code)] - pub fn new(workspace: Workspace, user_id: &str) -> Self { + pub fn new(workspace_rev: WorkspaceRevision, user_id: &str) -> Self { WorkspaceTable { - id: workspace.id, - name: workspace.name, - desc: workspace.desc, - modified_time: workspace.modified_time, - create_time: workspace.create_time, + id: workspace_rev.id, + name: workspace_rev.name, + desc: workspace_rev.desc, + modified_time: workspace_rev.modified_time, + create_time: workspace_rev.create_time, user_id: user_id.to_owned(), version: 0, } } } -impl std::convert::From for Workspace { +impl std::convert::From for WorkspaceRevision { fn from(table: WorkspaceTable) -> Self { - Workspace { + WorkspaceRevision { id: table.id, name: table.name, desc: table.desc, - apps: RepeatedApp::default(), + apps: vec![], modified_time: table.modified_time, create_time: table.create_time, } diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs index 40f72e10b0..7a51ac4e88 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs @@ -3,23 +3,19 @@ use crate::services::{ persistence::{AppChangeset, FolderPersistenceTransaction, ViewChangeset, WorkspaceChangeset}, }; use flowy_error::{FlowyError, FlowyResult}; -use flowy_folder_data_model::entities::{ - app::App, - trash::{RepeatedTrash, Trash}, - view::View, - workspace::Workspace, -}; + +use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use std::sync::Arc; impl FolderPersistenceTransaction for FolderEditor { - fn create_workspace(&self, _user_id: &str, workspace: Workspace) -> FlowyResult<()> { - if let Some(change) = self.folder.write().create_workspace(workspace)? { + fn create_workspace(&self, _user_id: &str, workspace_rev: WorkspaceRevision) -> FlowyResult<()> { + if let Some(change) = self.folder.write().create_workspace(workspace_rev)? { let _ = self.apply_change(change)?; } Ok(()) } - fn read_workspaces(&self, _user_id: &str, workspace_id: Option) -> FlowyResult> { + fn read_workspaces(&self, _user_id: &str, workspace_id: Option) -> FlowyResult> { let workspaces = self.folder.read().read_workspaces(workspace_id)?; Ok(workspaces) } @@ -42,8 +38,8 @@ impl FolderPersistenceTransaction for FolderEditor { Ok(()) } - fn create_app(&self, app: App) -> FlowyResult<()> { - if let Some(change) = self.folder.write().create_app(app)? { + fn create_app(&self, app_rev: AppRevision) -> FlowyResult<()> { + if let Some(change) = self.folder.write().create_app(app_rev)? { let _ = self.apply_change(change)?; } Ok(()) @@ -60,22 +56,22 @@ impl FolderPersistenceTransaction for FolderEditor { Ok(()) } - fn read_app(&self, app_id: &str) -> FlowyResult { + fn read_app(&self, app_id: &str) -> FlowyResult { let app = self.folder.read().read_app(app_id)?; Ok(app) } - fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { + fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { let workspaces = self.folder.read().read_workspaces(Some(workspace_id.to_owned()))?; match workspaces.first() { None => { Err(FlowyError::record_not_found().context(format!("can't find workspace with id {}", workspace_id))) } - Some(workspace) => Ok(workspace.apps.clone().take_items()), + Some(workspace) => Ok(workspace.apps.clone()), } } - fn delete_app(&self, app_id: &str) -> FlowyResult { + fn delete_app(&self, app_id: &str) -> FlowyResult { let app = self.folder.read().read_app(app_id)?; if let Some(change) = self.folder.write().delete_app(app_id)? { let _ = self.apply_change(change)?; @@ -90,19 +86,19 @@ impl FolderPersistenceTransaction for FolderEditor { Ok(()) } - fn create_view(&self, view: View) -> FlowyResult<()> { - if let Some(change) = self.folder.write().create_view(view)? { + fn create_view(&self, view_rev: ViewRevision) -> FlowyResult<()> { + if let Some(change) = self.folder.write().create_view(view_rev)? { let _ = self.apply_change(change)?; } Ok(()) } - fn read_view(&self, view_id: &str) -> FlowyResult { + fn read_view(&self, view_id: &str) -> FlowyResult { let view = self.folder.read().read_view(view_id)?; Ok(view) } - fn read_views(&self, belong_to_id: &str) -> FlowyResult> { + fn read_views(&self, belong_to_id: &str) -> FlowyResult> { let views = self.folder.read().read_views(belong_to_id)?; Ok(views) } @@ -132,16 +128,16 @@ impl FolderPersistenceTransaction for FolderEditor { Ok(()) } - fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { + fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { if let Some(change) = self.folder.write().create_trash(trashes)? { let _ = self.apply_change(change)?; } Ok(()) } - fn read_trash(&self, trash_id: Option) -> FlowyResult { + fn read_trash(&self, trash_id: Option) -> FlowyResult> { let trash = self.folder.read().read_trash(trash_id)?; - Ok(RepeatedTrash { items: trash }) + Ok(trash) } fn delete_trash(&self, trash_ids: Option>) -> FlowyResult<()> { @@ -156,11 +152,11 @@ impl FolderPersistenceTransaction for Arc where T: FolderPersistenceTransaction + ?Sized, { - fn create_workspace(&self, user_id: &str, workspace: Workspace) -> FlowyResult<()> { - (**self).create_workspace(user_id, workspace) + fn create_workspace(&self, user_id: &str, workspace_rev: WorkspaceRevision) -> FlowyResult<()> { + (**self).create_workspace(user_id, workspace_rev) } - fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult> { + fn read_workspaces(&self, user_id: &str, workspace_id: Option) -> FlowyResult> { (**self).read_workspaces(user_id, workspace_id) } @@ -172,23 +168,23 @@ where (**self).delete_workspace(workspace_id) } - fn create_app(&self, app: App) -> FlowyResult<()> { - (**self).create_app(app) + fn create_app(&self, app_rev: AppRevision) -> FlowyResult<()> { + (**self).create_app(app_rev) } fn update_app(&self, changeset: AppChangeset) -> FlowyResult<()> { (**self).update_app(changeset) } - fn read_app(&self, app_id: &str) -> FlowyResult { + fn read_app(&self, app_id: &str) -> FlowyResult { (**self).read_app(app_id) } - fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { + fn read_workspace_apps(&self, workspace_id: &str) -> FlowyResult> { (**self).read_workspace_apps(workspace_id) } - fn delete_app(&self, app_id: &str) -> FlowyResult { + fn delete_app(&self, app_id: &str) -> FlowyResult { (**self).delete_app(app_id) } @@ -196,15 +192,15 @@ where (**self).move_app(app_id, from, to) } - fn create_view(&self, view: View) -> FlowyResult<()> { - (**self).create_view(view) + fn create_view(&self, view_rev: ViewRevision) -> FlowyResult<()> { + (**self).create_view(view_rev) } - fn read_view(&self, view_id: &str) -> FlowyResult { + fn read_view(&self, view_id: &str) -> FlowyResult { (**self).read_view(view_id) } - fn read_views(&self, belong_to_id: &str) -> FlowyResult> { + fn read_views(&self, belong_to_id: &str) -> FlowyResult> { (**self).read_views(belong_to_id) } @@ -220,11 +216,11 @@ where (**self).move_view(view_id, from, to) } - fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { + fn create_trash(&self, trashes: Vec) -> FlowyResult<()> { (**self).create_trash(trashes) } - fn read_trash(&self, trash_id: Option) -> FlowyResult { + fn read_trash(&self, trash_id: Option) -> FlowyResult> { (**self).read_trash(trash_id) } diff --git a/frontend/rust-lib/flowy-folder/src/services/trash/controller.rs b/frontend/rust-lib/flowy-folder/src/services/trash/controller.rs index cdbabc1320..5fe144e81f 100644 --- a/frontend/rust-lib/flowy-folder/src/services/trash/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/trash/controller.rs @@ -6,6 +6,7 @@ use crate::{ services::persistence::{FolderPersistence, FolderPersistenceTransaction}, }; +use flowy_folder_data_model::revision::TrashRevision; use std::{fmt::Formatter, sync::Arc}; use tokio::sync::{broadcast, mpsc}; @@ -66,18 +67,18 @@ impl TrashController { #[tracing::instrument(level = "debug", skip(self) err)] pub async fn restore_all_trash(&self) -> FlowyResult<()> { - let repeated_trash = self + let trash_identifier: RepeatedTrashId = self .persistence .begin_transaction(|transaction| { let trash = transaction.read_trash(None); let _ = transaction.delete_trash(None); trash }) - .await?; + .await? + .into(); - let identifiers: RepeatedTrashId = repeated_trash.items.clone().into(); let (tx, mut rx) = mpsc::channel::>(1); - let _ = self.notify.send(TrashEvent::Putback(identifiers, tx)); + let _ = self.notify.send(TrashEvent::Putback(trash_identifier, tx)); let _ = rx.recv().await; notify_trash_changed(RepeatedTrash { items: vec![] }); @@ -87,12 +88,13 @@ impl TrashController { #[tracing::instrument(level = "debug", skip(self), err)] pub async fn delete_all_trash(&self) -> FlowyResult<()> { - let repeated_trash = self + let all_trash_identifiers: RepeatedTrashId = self .persistence .begin_transaction(|transaction| transaction.read_trash(None)) - .await?; - let trash_identifiers: RepeatedTrashId = repeated_trash.items.clone().into(); - let _ = self.delete_with_identifiers(trash_identifiers.clone()).await?; + .await? + .into(); + + let _ = self.delete_with_identifiers(all_trash_identifiers).await?; notify_trash_changed(RepeatedTrash { items: vec![] }); let _ = self.delete_all_trash_on_server().await?; @@ -102,11 +104,12 @@ impl TrashController { #[tracing::instrument(level = "debug", skip(self), err)] pub async fn delete(&self, trash_identifiers: RepeatedTrashId) -> FlowyResult<()> { let _ = self.delete_with_identifiers(trash_identifiers.clone()).await?; - let repeated_trash = self + let trash_revs = self .persistence .begin_transaction(|transaction| transaction.read_trash(None)) .await?; - notify_trash_changed(repeated_trash); + + notify_trash_changed(trash_revs); let _ = self.delete_trash_on_server(trash_identifiers)?; Ok(()) @@ -147,10 +150,10 @@ impl TrashController { // CREATE and DROP tables operations because those are auto-commit in the // database. #[tracing::instrument(name = "add_trash", level = "debug", skip(self, trash), fields(trash_ids), err)] - pub async fn add>(&self, trash: Vec) -> Result<(), FlowyError> { + pub async fn add>(&self, trash: Vec) -> Result<(), FlowyError> { let (tx, mut rx) = mpsc::channel::>(1); - let repeated_trash = trash.into_iter().map(|t| t.into()).collect::>(); - let identifiers = repeated_trash.iter().map(|t| t.into()).collect::>(); + let trash_revs: Vec = trash.into_iter().map(|t| t.into()).collect(); + let identifiers = trash_revs.iter().map(|t| t.into()).collect::>(); tracing::Span::current().record( "trash_ids", @@ -167,8 +170,9 @@ impl TrashController { let _ = self .persistence .begin_transaction(|transaction| { - let _ = transaction.create_trash(repeated_trash.clone())?; - let _ = self.create_trash_on_server(repeated_trash); + let _ = transaction.create_trash(trash_revs.clone())?; + let _ = self.create_trash_on_server(trash_revs); + notify_trash_changed(transaction.read_trash(None)?); Ok(()) }) @@ -184,12 +188,16 @@ impl TrashController { } pub async fn read_trash(&self) -> Result { - let repeated_trash = self + let items: Vec = self .persistence .begin_transaction(|transaction| transaction.read_trash(None)) - .await?; + .await? + .into_iter() + .map(|trash_rev| trash_rev.into()) + .collect(); + let _ = self.read_trash_on_server()?; - Ok(repeated_trash) + Ok(RepeatedTrash { items }) } pub fn read_trash_ids<'a>( @@ -198,7 +206,6 @@ impl TrashController { ) -> Result, FlowyError> { let ids = transaction .read_trash(None)? - .into_inner() .into_iter() .map(|item| item.id) .collect::>(); @@ -244,18 +251,18 @@ impl TrashController { tokio::spawn(async move { match server.read_trash(&token).await { - Ok(repeated_trash) => { - tracing::debug!("Remote trash count: {}", repeated_trash.items.len()); + Ok(trash_rev) => { + tracing::debug!("Remote trash count: {}", trash_rev.len()); let result = persistence .begin_transaction(|transaction| { - let _ = transaction.create_trash(repeated_trash.items.clone())?; + let _ = transaction.create_trash(trash_rev.clone())?; transaction.read_trash(None) }) .await; match result { - Ok(repeated_trash) => { - notify_trash_changed(repeated_trash); + Ok(trash_revs) => { + notify_trash_changed(trash_revs); } Err(e) => log::error!("Save trash failed: {:?}", e), } @@ -275,7 +282,8 @@ impl TrashController { } #[tracing::instrument(level = "debug", skip(repeated_trash), fields(n_trash))] -fn notify_trash_changed(repeated_trash: RepeatedTrash) { +fn notify_trash_changed>(repeated_trash: T) { + let repeated_trash = repeated_trash.into(); tracing::Span::current().record("n_trash", &repeated_trash.len()); send_anonymous_dart_notification(FolderNotification::TrashUpdated) .payload(repeated_trash) diff --git a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs index 4de3b306d8..54551fd431 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs @@ -15,6 +15,7 @@ use crate::{ use bytes::Bytes; use flowy_database::kv::KV; use flowy_folder_data_model::entities::view::{gen_view_id, ViewDataType}; +use flowy_folder_data_model::revision::ViewRevision; use flowy_sync::entities::text_block_info::TextBlockId; use futures::{FutureExt, StreamExt}; use std::{collections::HashSet, sync::Arc}; @@ -52,7 +53,10 @@ impl ViewController { } #[tracing::instrument(level = "trace", skip(self, params), fields(name = %params.name), err)] - pub(crate) async fn create_view_from_params(&self, mut params: CreateViewParams) -> Result { + pub(crate) async fn create_view_from_params( + &self, + mut params: CreateViewParams, + ) -> Result { let processor = self.get_data_processor(¶ms.data_type)?; let user_id = self.user.user_id()?; if params.data.is_empty() { @@ -67,9 +71,9 @@ impl ViewController { .await?; }; - let view = self.create_view_on_server(params).await?; - let _ = self.create_view_on_local(view.clone()).await?; - Ok(view) + let view_rev = self.create_view_on_server(params).await?; + let _ = self.create_view_on_local(view_rev.clone()).await?; + Ok(view_rev) } #[tracing::instrument(level = "debug", skip(self, view_id, delta_data), err)] @@ -88,12 +92,12 @@ impl ViewController { Ok(()) } - pub(crate) async fn create_view_on_local(&self, view: View) -> Result<(), FlowyError> { + pub(crate) async fn create_view_on_local(&self, view_rev: ViewRevision) -> Result<(), FlowyError> { let trash_controller = self.trash_controller.clone(); self.persistence .begin_transaction(|transaction| { - let belong_to_id = view.belong_to_id.clone(); - let _ = transaction.create_view(view)?; + let belong_to_id = view_rev.belong_to_id.clone(); + let _ = transaction.create_view(view_rev)?; let _ = notify_views_changed(&belong_to_id, trash_controller, &transaction)?; Ok(()) }) @@ -101,8 +105,8 @@ impl ViewController { } #[tracing::instrument(level = "debug", skip(self, view_id), fields(view_id = %view_id.value), err)] - pub(crate) async fn read_view(&self, view_id: ViewId) -> Result { - let view = self + pub(crate) async fn read_view(&self, view_id: ViewId) -> Result { + let view_rev = self .persistence .begin_transaction(|transaction| { let view = transaction.read_view(&view_id.value)?; @@ -114,10 +118,10 @@ impl ViewController { }) .await?; let _ = self.read_view_on_server(view_id); - Ok(view) + Ok(view_rev) } - pub(crate) async fn read_local_views(&self, ids: Vec) -> Result, FlowyError> { + pub(crate) async fn read_local_views(&self, ids: Vec) -> Result, FlowyError> { self.persistence .begin_transaction(|transaction| { let mut views = vec![]; @@ -170,22 +174,22 @@ impl ViewController { #[tracing::instrument(level = "debug", skip(self), err)] pub(crate) async fn duplicate_view(&self, view_id: &str) -> Result<(), FlowyError> { - let view = self + let view_rev = self .persistence .begin_transaction(|transaction| transaction.read_view(view_id)) .await?; - let processor = self.get_data_processor(&view.data_type)?; + let processor = self.get_data_processor(&view_rev.data_type)?; let delta_bytes = processor.view_delta_data(view_id).await?; let duplicate_params = CreateViewParams { - belong_to_id: view.belong_to_id.clone(), - name: format!("{} (copy)", &view.name), - desc: view.desc, - thumbnail: view.thumbnail, - data_type: view.data_type, + belong_to_id: view_rev.belong_to_id.clone(), + name: format!("{} (copy)", &view_rev.name), + desc: view_rev.desc, + thumbnail: view_rev.thumbnail, + data_type: view_rev.data_type, data: delta_bytes.to_vec(), view_id: gen_view_id(), - plugin_type: view.plugin_type, + plugin_type: view_rev.plugin_type, }; let _ = self.create_view_from_params(duplicate_params).await?; @@ -194,7 +198,7 @@ impl ViewController { // belong_to_id will be the app_id or view_id. #[tracing::instrument(level = "trace", skip(self), err)] - pub(crate) async fn read_views_belong_to(&self, belong_to_id: &str) -> Result { + pub(crate) async fn read_views_belong_to(&self, belong_to_id: &str) -> Result, FlowyError> { self.persistence .begin_transaction(|transaction| { read_belonging_views_on_local(belong_to_id, self.trash_controller.clone(), &transaction) @@ -203,35 +207,36 @@ impl ViewController { } #[tracing::instrument(level = "debug", skip(self, params), err)] - pub(crate) async fn update_view(&self, params: UpdateViewParams) -> Result { + pub(crate) async fn update_view(&self, params: UpdateViewParams) -> Result { let changeset = ViewChangeset::new(params.clone()); let view_id = changeset.id.clone(); - let view = self + let view_rev = self .persistence .begin_transaction(|transaction| { let _ = transaction.update_view(changeset)?; - let view = transaction.read_view(&view_id)?; + let view_rev = transaction.read_view(&view_id)?; + let view: View = view_rev.clone().into(); send_dart_notification(&view_id, FolderNotification::ViewUpdated) - .payload(view.clone()) + .payload(view) .send(); - let _ = notify_views_changed(&view.belong_to_id, self.trash_controller.clone(), &transaction)?; - Ok(view) + let _ = notify_views_changed(&view_rev.belong_to_id, self.trash_controller.clone(), &transaction)?; + Ok(view_rev) }) .await?; let _ = self.update_view_on_server(params); - Ok(view) + Ok(view_rev) } - pub(crate) async fn latest_visit_view(&self) -> FlowyResult> { + pub(crate) async fn latest_visit_view(&self) -> FlowyResult> { match KV::get_str(LATEST_VIEW_ID) { None => Ok(None), Some(view_id) => { - let view = self + let view_rev = self .persistence .begin_transaction(|transaction| transaction.read_view(&view_id)) .await?; - Ok(Some(view)) + Ok(Some(view_rev)) } } } @@ -239,10 +244,10 @@ impl ViewController { impl ViewController { #[tracing::instrument(level = "debug", skip(self, params), err)] - async fn create_view_on_server(&self, params: CreateViewParams) -> Result { + async fn create_view_on_server(&self, params: CreateViewParams) -> Result { let token = self.user.token()?; - let view = self.cloud_service.create_view(&token, params).await?; - Ok(view) + let view_rev = self.cloud_service.create_view(&token, params).await?; + Ok(view_rev) } #[tracing::instrument(level = "debug", skip(self), err)] @@ -269,14 +274,15 @@ impl ViewController { // TODO: Retry with RetryAction? tokio::spawn(async move { match server.read_view(&token, params).await { - Ok(Some(view)) => { + Ok(Some(view_rev)) => { match persistence - .begin_transaction(|transaction| transaction.create_view(view.clone())) + .begin_transaction(|transaction| transaction.create_view(view_rev.clone())) .await { Ok(_) => { + let view: View = view_rev.into(); send_dart_notification(&view.id, FolderNotification::ViewUpdated) - .payload(view.clone()) + .payload(view) .send(); } Err(e) => log::error!("Save view failed: {:?}", e), @@ -350,10 +356,10 @@ async fn handle_trash_event( TrashEvent::NewTrash(identifiers, ret) => { let result = persistence .begin_transaction(|transaction| { - let views = read_local_views_with_transaction(identifiers, &transaction)?; - for view in views { - let _ = notify_views_changed(&view.belong_to_id, trash_can.clone(), &transaction)?; - notify_dart(view, FolderNotification::ViewDeleted); + let view_revs = read_local_views_with_transaction(identifiers, &transaction)?; + for view_rev in view_revs { + let _ = notify_views_changed(&view_rev.belong_to_id, trash_can.clone(), &transaction)?; + notify_dart(view_rev.into(), FolderNotification::ViewDeleted); } Ok(()) }) @@ -363,10 +369,10 @@ async fn handle_trash_event( TrashEvent::Putback(identifiers, ret) => { let result = persistence .begin_transaction(|transaction| { - let views = read_local_views_with_transaction(identifiers, &transaction)?; - for view in views { - let _ = notify_views_changed(&view.belong_to_id, trash_can.clone(), &transaction)?; - notify_dart(view, FolderNotification::ViewRestored); + let view_revs = read_local_views_with_transaction(identifiers, &transaction)?; + for view_rev in view_revs { + let _ = notify_views_changed(&view_rev.belong_to_id, trash_can.clone(), &transaction)?; + notify_dart(view_rev.into(), FolderNotification::ViewRestored); } Ok(()) }) @@ -425,13 +431,12 @@ fn get_data_processor( fn read_local_views_with_transaction<'a>( identifiers: RepeatedTrashId, transaction: &'a (dyn FolderPersistenceTransaction + 'a), -) -> Result, FlowyError> { - let mut views = vec![]; +) -> Result, FlowyError> { + let mut view_revs = vec![]; for identifier in identifiers.items { - let view = transaction.read_view(&identifier.id)?; - views.push(view); + view_revs.push(transaction.read_view(&identifier.id)?); } - Ok(views) + Ok(view_revs) } fn notify_dart(view: View, notification: FolderNotification) { @@ -449,8 +454,13 @@ fn notify_views_changed<'a>( trash_controller: Arc, transaction: &'a (dyn FolderPersistenceTransaction + 'a), ) -> FlowyResult<()> { - let repeated_view = read_belonging_views_on_local(belong_to_id, trash_controller.clone(), transaction)?; - tracing::Span::current().record("view_count", &format!("{}", repeated_view.len()).as_str()); + let items: Vec = read_belonging_views_on_local(belong_to_id, trash_controller.clone(), transaction)? + .into_iter() + .map(|view_rev| view_rev.into()) + .collect(); + tracing::Span::current().record("view_count", &format!("{}", items.len()).as_str()); + + let repeated_view = RepeatedView { items }; send_dart_notification(belong_to_id, FolderNotification::AppViewsChanged) .payload(repeated_view) .send(); @@ -461,10 +471,10 @@ fn read_belonging_views_on_local<'a>( belong_to_id: &str, trash_controller: Arc, transaction: &'a (dyn FolderPersistenceTransaction + 'a), -) -> FlowyResult { - let mut views = transaction.read_views(belong_to_id)?; +) -> FlowyResult> { + let mut view_revs = transaction.read_views(belong_to_id)?; let trash_ids = trash_controller.read_trash_ids(transaction)?; - views.retain(|view_table| !trash_ids.contains(&view_table.id)); + view_revs.retain(|view_table| !trash_ids.contains(&view_table.id)); - Ok(RepeatedView { items: views }) + Ok(view_revs) } diff --git a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs index caa8134785..3714578cf4 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs @@ -11,6 +11,8 @@ use crate::{ services::{TrashController, ViewController}, }; use flowy_folder_data_model::entities::view::{MoveFolderItemParams, MoveFolderItemPayload, MoveFolderItemType}; +use flowy_folder_data_model::entities::ViewInfo; +use flowy_folder_data_model::revision::TrashRevision; use lib_dispatch::prelude::{data_result, AppData, Data, DataResult}; use std::{convert::TryInto, sync::Arc}; @@ -19,8 +21,8 @@ pub(crate) async fn create_view_handler( controller: AppData>, ) -> DataResult { let params: CreateViewParams = data.into_inner().try_into()?; - let view = controller.create_view_from_params(params).await?; - data_result(view) + let view_rev = controller.create_view_from_params(params).await?; + data_result(view_rev.into()) } pub(crate) async fn read_view_handler( @@ -28,12 +30,18 @@ pub(crate) async fn read_view_handler( controller: AppData>, ) -> DataResult { let view_id: ViewId = data.into_inner(); - let mut view = controller.read_view(view_id.clone()).await?; + let view_rev = controller.read_view(view_id.clone()).await?; + data_result(view_rev.into()) +} + +pub(crate) async fn read_view_info_handler( + _data: Data, + _controller: AppData>, +) -> DataResult { // For the moment, app and view can contains lots of views. Reading the view // belongings using the view_id. - view.belongings = controller.read_views_belong_to(&view_id.value).await?; - - data_result(view) + // view.belongings = controller.read_views_belong_to(&view_id.value).await?; + todo!() } #[tracing::instrument(level = "debug", skip(data, controller), err)] @@ -61,7 +69,10 @@ pub(crate) async fn delete_view_handler( .read_local_views(params.items) .await? .into_iter() - .map(|view| view.into()) + .map(|view| { + let trash_rev: TrashRevision = view.into(); + trash_rev.into() + }) .collect::>(); let _ = trash_controller.add(trash).await?; diff --git a/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs b/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs index b343c5b46d..f1b4ab5289 100644 --- a/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/workspace/controller.rs @@ -9,7 +9,8 @@ use crate::{ }, }; use flowy_database::kv::KV; -use flowy_folder_data_model::entities::{app::RepeatedApp, workspace::*}; +use flowy_folder_data_model::entities::workspace::*; +use flowy_folder_data_model::revision::{AppRevision, WorkspaceRevision}; use std::sync::Arc; pub struct WorkspaceController { @@ -37,7 +38,7 @@ impl WorkspaceController { pub(crate) async fn create_workspace_from_params( &self, params: CreateWorkspaceParams, - ) -> Result { + ) -> Result { let workspace = self.create_workspace_on_server(params.clone()).await?; let user_id = self.user.user_id()?; let token = self.user.token()?; @@ -47,7 +48,10 @@ impl WorkspaceController { let _ = transaction.create_workspace(&user_id, workspace.clone())?; transaction.read_workspaces(&user_id, None) }) - .await?; + .await? + .into_iter() + .map(|workspace_rev| workspace_rev.into()) + .collect(); let repeated_workspace = RepeatedWorkspace { items: workspaces }; send_dart_notification(&token, FolderNotification::UserCreateWorkspace) .payload(repeated_workspace) @@ -109,16 +113,16 @@ impl WorkspaceController { } } - pub(crate) async fn read_current_workspace_apps(&self) -> Result { + pub(crate) async fn read_current_workspace_apps(&self) -> Result, FlowyError> { let workspace_id = get_current_workspace()?; - let repeated_app = self + let app_revs = self .persistence .begin_transaction(|transaction| { read_local_workspace_apps(&workspace_id, self.trash_controller.clone(), &transaction) }) .await?; // TODO: read from server - Ok(repeated_app) + Ok(app_revs) } #[tracing::instrument(level = "debug", skip(self, transaction), err)] @@ -129,7 +133,11 @@ impl WorkspaceController { transaction: &'a (dyn FolderPersistenceTransaction + 'a), ) -> Result { let workspace_id = workspace_id.to_owned(); - let workspaces = transaction.read_workspaces(user_id, workspace_id)?; + let workspaces = transaction + .read_workspaces(user_id, workspace_id)? + .into_iter() + .map(|workspace_rev| workspace_rev.into()) + .collect(); Ok(RepeatedWorkspace { items: workspaces }) } @@ -139,22 +147,26 @@ impl WorkspaceController { user_id: &str, transaction: &'a (dyn FolderPersistenceTransaction + 'a), ) -> Result { - let mut workspaces = transaction.read_workspaces(user_id, Some(workspace_id.clone()))?; - if workspaces.is_empty() { + let mut workspace_revs = transaction.read_workspaces(user_id, Some(workspace_id.clone()))?; + if workspace_revs.is_empty() { return Err(FlowyError::record_not_found().context(format!("{} workspace not found", workspace_id))); } - debug_assert_eq!(workspaces.len(), 1); - let workspace = workspaces.drain(..1).collect::>().pop().unwrap(); + debug_assert_eq!(workspace_revs.len(), 1); + let workspace = workspace_revs + .drain(..1) + .map(|workspace_rev| workspace_rev.into()) + .collect::>() + .pop() + .unwrap(); Ok(workspace) } } impl WorkspaceController { #[tracing::instrument(level = "trace", skip(self), err)] - async fn create_workspace_on_server(&self, params: CreateWorkspaceParams) -> Result { + async fn create_workspace_on_server(&self, params: CreateWorkspaceParams) -> Result { let token = self.user.token()?; - let workspace = self.cloud_service.create_workspace(&token, params).await?; - Ok(workspace) + self.cloud_service.create_workspace(&token, params).await } #[tracing::instrument(level = "trace", skip(self), err)] @@ -211,7 +223,7 @@ pub async fn notify_workspace_setting_did_change( let setting = match transaction.read_view(view_id) { Ok(latest_view) => CurrentWorkspaceSetting { workspace, - latest_view: Some(latest_view), + latest_view: Some(latest_view.into()), }, Err(_) => CurrentWorkspaceSetting { workspace, diff --git a/frontend/rust-lib/flowy-folder/src/services/workspace/event_handler.rs b/frontend/rust-lib/flowy-folder/src/services/workspace/event_handler.rs index d274e42f7f..3760d06bf6 100644 --- a/frontend/rust-lib/flowy-folder/src/services/workspace/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/services/workspace/event_handler.rs @@ -9,7 +9,6 @@ use flowy_folder_data_model::entities::{ view::View, workspace::{CurrentWorkspaceSetting, RepeatedWorkspace, WorkspaceId, *}, }; - use lib_dispatch::prelude::{data_result, AppData, Data, DataResult}; use std::{convert::TryInto, sync::Arc}; @@ -20,15 +19,21 @@ pub(crate) async fn create_workspace_handler( ) -> DataResult { let controller = controller.get_ref().clone(); let params: CreateWorkspaceParams = data.into_inner().try_into()?; - let detail = controller.create_workspace_from_params(params).await?; - data_result(detail) + let workspace_rev = controller.create_workspace_from_params(params).await?; + data_result(workspace_rev.into()) } #[tracing::instrument(level = "debug", skip(controller), err)] pub(crate) async fn read_workspace_apps_handler( controller: AppData>, ) -> DataResult { - let repeated_app = controller.read_current_workspace_apps().await?; + let items = controller + .read_current_workspace_apps() + .await? + .into_iter() + .map(|app_rev| app_rev.into()) + .collect(); + let repeated_app = RepeatedApp { items }; data_result(repeated_app) } @@ -58,8 +63,10 @@ pub(crate) async fn read_workspaces_handler( let mut workspaces = workspace_controller.read_local_workspaces(params.value.clone(), &user_id, &transaction)?; for workspace in workspaces.iter_mut() { - let apps = - read_local_workspace_apps(&workspace.id, trash_controller.clone(), &transaction)?.into_inner(); + let apps = read_local_workspace_apps(&workspace.id, trash_controller.clone(), &transaction)? + .into_iter() + .map(|app_rev| app_rev.into()) + .collect(); workspace.apps.items = apps; } Ok(workspaces) @@ -88,7 +95,12 @@ pub async fn read_cur_workspace_handler( }) .await?; - let latest_view: Option = folder.view_controller.latest_visit_view().await.unwrap_or(None); + let latest_view: Option = folder + .view_controller + .latest_visit_view() + .await + .unwrap_or(None) + .map(|view_rev| view_rev.into()); let setting = CurrentWorkspaceSetting { workspace, latest_view }; let _ = read_workspaces_on_server(folder, user_id, params); data_result(setting) @@ -104,25 +116,25 @@ fn read_workspaces_on_server( let persistence = folder_manager.persistence.clone(); tokio::spawn(async move { - let workspaces = server.read_workspace(&token, params).await?; + let workspace_revs = server.read_workspace(&token, params).await?; let _ = persistence .begin_transaction(|transaction| { - tracing::trace!("Save {} workspace", workspaces.len()); - for workspace in &workspaces.items { - let m_workspace = workspace.clone(); - let apps = m_workspace.apps.clone().into_inner(); + tracing::trace!("Save {} workspace", workspace_revs.len()); + for workspace_rev in &workspace_revs { + let m_workspace = workspace_rev.clone(); + let app_revs = m_workspace.apps.clone(); let _ = transaction.create_workspace(&user_id, m_workspace)?; - tracing::trace!("Save {} apps", apps.len()); - for app in apps { - let views = app.belongings.clone().into_inner(); - match transaction.create_app(app) { + tracing::trace!("Save {} apps", app_revs.len()); + for app_rev in app_revs { + let view_revs = app_rev.belongings.clone(); + match transaction.create_app(app_rev) { Ok(_) => {} Err(e) => log::error!("create app failed: {:?}", e), } - tracing::trace!("Save {} views", views.len()); - for view in views { - match transaction.create_view(view) { + tracing::trace!("Save {} views", view_revs.len()); + for view_rev in view_revs { + match transaction.create_view(view_rev) { Ok(_) => {} Err(e) => log::error!("create view failed: {:?}", e), } @@ -133,8 +145,15 @@ fn read_workspaces_on_server( }) .await?; + let repeated_workspace = RepeatedWorkspace { + items: workspace_revs + .into_iter() + .map(|workspace_rev| workspace_rev.into()) + .collect(), + }; + send_dart_notification(&token, FolderNotification::WorkspaceListUpdated) - .payload(workspaces) + .payload(repeated_workspace) .send(); Result::<(), FlowyError>::Ok(()) }); diff --git a/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs b/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs index b9fc8c2585..9eaee19b61 100644 --- a/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs +++ b/frontend/rust-lib/flowy-folder/tests/workspace/folder_test.rs @@ -1,7 +1,7 @@ use crate::script::{invalid_workspace_name_test_case, FolderScript::*, FolderTest}; use flowy_folder::entities::workspace::CreateWorkspacePayload; use flowy_folder_data_model::entities::view::ViewDataType; -use flowy_folder_data_model::revision::{AppRevision, WorkspaceRevision}; + use flowy_revision::disk::RevisionState; use flowy_test::{event_builder::*, FlowySDKTest}; @@ -38,12 +38,9 @@ async fn workspace_create() { async fn workspace_read() { let mut test = FolderTest::new().await; let workspace = test.workspace.clone(); - let workspace_revision: WorkspaceRevision = workspace.clone().into(); - let json = serde_json::to_string(&workspace_revision).unwrap(); test.run_scripts(vec![ ReadWorkspace(Some(workspace.id.clone())), - AssertWorkspaceRevisionJson(json), AssertWorkspace(workspace), ]) .await; @@ -59,10 +56,7 @@ async fn workspace_create_with_apps() { .await; let app = test.app.clone(); - let app_revision: AppRevision = app.clone().into(); - let json = serde_json::to_string(&app_revision).unwrap(); - test.run_scripts(vec![ReadApp(app.id), AssertAppRevisionJson(json)]) - .await; + test.run_scripts(vec![ReadApp(app.id)]).await; } #[tokio::test] @@ -346,7 +340,6 @@ async fn folder_sync_revision_with_new_view() { let view = test.view.clone(); assert_eq!(view.name, view_name); - assert_eq!(view.desc, view_desc); test.run_scripts(vec![ReadView(view.id.clone()), AssertView(view)]) .await; } diff --git a/frontend/rust-lib/flowy-folder/tests/workspace/script.rs b/frontend/rust-lib/flowy-folder/tests/workspace/script.rs index e4fcc78fa4..e8303f9c42 100644 --- a/frontend/rust-lib/flowy-folder/tests/workspace/script.rs +++ b/frontend/rust-lib/flowy-folder/tests/workspace/script.rs @@ -14,7 +14,7 @@ use flowy_folder_data_model::entities::{ view::{CreateViewPayload, UpdateViewPayload}, workspace::{CreateWorkspacePayload, RepeatedWorkspace}, }; -use flowy_folder_data_model::revision::{AppRevision, WorkspaceRevision}; + use flowy_revision::disk::RevisionState; use flowy_revision::REVISION_WRITE_INTERVAL_IN_MILLIS; use flowy_sync::entities::text_block_info::TextBlockInfo; @@ -29,7 +29,7 @@ pub enum FolderScript { name: String, desc: String, }, - AssertWorkspaceRevisionJson(String), + // AssertWorkspaceRevisionJson(String), AssertWorkspace(Workspace), ReadWorkspace(Option), @@ -38,7 +38,7 @@ pub enum FolderScript { name: String, desc: String, }, - AssertAppRevisionJson(String), + // AssertAppRevisionJson(String), AssertApp(App), ReadApp(String), UpdateApp { @@ -139,15 +139,15 @@ impl FolderTest { let workspace = create_workspace(sdk, &name, &desc).await; self.workspace = workspace; } - FolderScript::AssertWorkspaceRevisionJson(expected_json) => { - let workspace = read_workspace(sdk, Some(self.workspace.id.clone())) - .await - .pop() - .unwrap(); - let workspace_revision: WorkspaceRevision = workspace.into(); - let json = serde_json::to_string(&workspace_revision).unwrap(); - assert_eq!(json, expected_json); - } + // FolderScript::AssertWorkspaceRevisionJson(expected_json) => { + // let workspace = read_workspace(sdk, Some(self.workspace.id.clone())) + // .await + // .pop() + // .unwrap(); + // let workspace_revision: WorkspaceRevision = workspace.into(); + // let json = serde_json::to_string(&workspace_revision).unwrap(); + // assert_eq!(json, expected_json); + // } FolderScript::AssertWorkspace(workspace) => { assert_eq!(self.workspace, workspace); } @@ -159,11 +159,11 @@ impl FolderTest { let app = create_app(sdk, &self.workspace.id, &name, &desc).await; self.app = app; } - FolderScript::AssertAppRevisionJson(expected_json) => { - let app_revision: AppRevision = self.app.clone().into(); - let json = serde_json::to_string(&app_revision).unwrap(); - assert_eq!(json, expected_json); - } + // FolderScript::AssertAppRevisionJson(expected_json) => { + // let app_revision: AppRevision = self.app.clone().into(); + // let json = serde_json::to_string(&app_revision).unwrap(); + // assert_eq!(json, expected_json); + // } FolderScript::AssertApp(app) => { assert_eq!(self.app, app); } diff --git a/frontend/rust-lib/flowy-net/src/http_server/folder.rs b/frontend/rust-lib/flowy-net/src/http_server/folder.rs index e70d690bb7..9781ea727a 100644 --- a/frontend/rust-lib/flowy-net/src/http_server/folder.rs +++ b/frontend/rust-lib/flowy-net/src/http_server/folder.rs @@ -4,13 +4,14 @@ use crate::{ }; use flowy_error::FlowyError; use flowy_folder_data_model::entities::{ - app::{App, AppId, CreateAppParams, UpdateAppParams}, - trash::{RepeatedTrash, RepeatedTrashId}, - view::{CreateViewParams, RepeatedViewId, UpdateViewParams, View, ViewId}, - workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceId}, + trash::RepeatedTrashId, + view::{CreateViewParams, RepeatedViewId, UpdateViewParams, ViewId}, + workspace::{CreateWorkspaceParams, UpdateWorkspaceParams, WorkspaceId}, + {AppId, CreateAppParams, UpdateAppParams}, }; use flowy_folder::event_map::FolderCouldServiceV1; +use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use http_flowy::errors::ServerError; use http_flowy::response::FlowyResponse; use lazy_static::lazy_static; @@ -31,7 +32,11 @@ impl FolderHttpCloudService { impl FolderCouldServiceV1 for FolderHttpCloudService { fn init(&self) {} - fn create_workspace(&self, token: &str, params: CreateWorkspaceParams) -> FutureResult { + fn create_workspace( + &self, + token: &str, + params: CreateWorkspaceParams, + ) -> FutureResult { let token = token.to_owned(); let url = self.config.workspace_url(); FutureResult::new(async move { @@ -40,12 +45,12 @@ impl FolderCouldServiceV1 for FolderHttpCloudService { }) } - fn read_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult { + fn read_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult, FlowyError> { let token = token.to_owned(); let url = self.config.workspace_url(); FutureResult::new(async move { - let repeated_workspace = read_workspaces_request(&token, params, &url).await?; - Ok(repeated_workspace) + let workspace_revs = read_workspaces_request(&token, params, &url).await?; + Ok(workspace_revs) }) } @@ -67,7 +72,7 @@ impl FolderCouldServiceV1 for FolderHttpCloudService { }) } - fn create_view(&self, token: &str, params: CreateViewParams) -> FutureResult { + fn create_view(&self, token: &str, params: CreateViewParams) -> FutureResult { let token = token.to_owned(); let url = self.config.view_url(); FutureResult::new(async move { @@ -76,12 +81,12 @@ impl FolderCouldServiceV1 for FolderHttpCloudService { }) } - fn read_view(&self, token: &str, params: ViewId) -> FutureResult, FlowyError> { + fn read_view(&self, token: &str, params: ViewId) -> FutureResult, FlowyError> { let token = token.to_owned(); let url = self.config.view_url(); FutureResult::new(async move { - let view = read_view_request(&token, params, &url).await?; - Ok(view) + let view_rev = read_view_request(&token, params, &url).await?; + Ok(view_rev) }) } @@ -103,7 +108,7 @@ impl FolderCouldServiceV1 for FolderHttpCloudService { }) } - fn create_app(&self, token: &str, params: CreateAppParams) -> FutureResult { + fn create_app(&self, token: &str, params: CreateAppParams) -> FutureResult { let token = token.to_owned(); let url = self.config.app_url(); FutureResult::new(async move { @@ -112,12 +117,12 @@ impl FolderCouldServiceV1 for FolderHttpCloudService { }) } - fn read_app(&self, token: &str, params: AppId) -> FutureResult, FlowyError> { + fn read_app(&self, token: &str, params: AppId) -> FutureResult, FlowyError> { let token = token.to_owned(); let url = self.config.app_url(); FutureResult::new(async move { - let app = read_app_request(&token, params, &url).await?; - Ok(app) + let app_rev = read_app_request(&token, params, &url).await?; + Ok(app_rev) }) } @@ -157,7 +162,7 @@ impl FolderCouldServiceV1 for FolderHttpCloudService { }) } - fn read_trash(&self, token: &str) -> FutureResult { + fn read_trash(&self, token: &str) -> FutureResult, FlowyError> { let token = token.to_owned(); let url = self.config.trash_url(); FutureResult::new(async move { @@ -172,32 +177,34 @@ fn request_builder() -> HttpRequestBuilder { } pub async fn create_workspace_request( - token: &str, - params: CreateWorkspaceParams, - url: &str, -) -> Result { - let workspace = request_builder() - .post(&url.to_owned()) - .header(HEADER_TOKEN, token) - .protobuf(params)? - .response() - .await?; - Ok(workspace) + _token: &str, + _params: CreateWorkspaceParams, + _url: &str, +) -> Result { + // let workspace = request_builder() + // .post(&url.to_owned()) + // .header(HEADER_TOKEN, token) + // .protobuf(params)? + // .response() + // .await?; + // Ok(workspace) + unimplemented!() } pub async fn read_workspaces_request( - token: &str, - params: WorkspaceId, - url: &str, -) -> Result { - let repeated_workspace = request_builder() - .get(&url.to_owned()) - .header(HEADER_TOKEN, token) - .protobuf(params)? - .response::() - .await?; - - Ok(repeated_workspace) + _token: &str, + _params: WorkspaceId, + _url: &str, +) -> Result, ServerError> { + // let repeated_workspace = request_builder() + // .get(&url.to_owned()) + // .header(HEADER_TOKEN, token) + // .protobuf(params)? + // .response::() + // .await?; + // + // Ok(repeated_workspace) + unimplemented!() } pub async fn update_workspace_request( @@ -225,25 +232,31 @@ pub async fn delete_workspace_request(token: &str, params: WorkspaceId, url: &st } // App -pub async fn create_app_request(token: &str, params: CreateAppParams, url: &str) -> Result { - let app = request_builder() - .post(&url.to_owned()) - .header(HEADER_TOKEN, token) - .protobuf(params)? - .response() - .await?; - Ok(app) +pub async fn create_app_request( + _token: &str, + _params: CreateAppParams, + _url: &str, +) -> Result { + // let app = request_builder() + // .post(&url.to_owned()) + // .header(HEADER_TOKEN, token) + // .protobuf(params)? + // .response() + // .await?; + // Ok(app) + unimplemented!() } -pub async fn read_app_request(token: &str, params: AppId, url: &str) -> Result, ServerError> { - let app = request_builder() - .get(&url.to_owned()) - .header(HEADER_TOKEN, token) - .protobuf(params)? - .option_response() - .await?; +pub async fn read_app_request(_token: &str, _params: AppId, _url: &str) -> Result, ServerError> { + // let app = request_builder() + // .get(&url.to_owned()) + // .header(HEADER_TOKEN, token) + // .protobuf(params)? + // .option_response() + // .await?; + // Ok(app) - Ok(app) + unimplemented!() } pub async fn update_app_request(token: &str, params: UpdateAppParams, url: &str) -> Result<(), ServerError> { @@ -267,25 +280,31 @@ pub async fn delete_app_request(token: &str, params: AppId, url: &str) -> Result } // View -pub async fn create_view_request(token: &str, params: CreateViewParams, url: &str) -> Result { - let view = request_builder() - .post(&url.to_owned()) - .header(HEADER_TOKEN, token) - .protobuf(params)? - .response() - .await?; - Ok(view) +pub async fn create_view_request( + _token: &str, + _params: CreateViewParams, + _url: &str, +) -> Result { + // let view = request_builder() + // .post(&url.to_owned()) + // .header(HEADER_TOKEN, token) + // .protobuf(params)? + // .response() + // .await?; + // Ok(view) + unimplemented!() } -pub async fn read_view_request(token: &str, params: ViewId, url: &str) -> Result, ServerError> { - let view = request_builder() - .get(&url.to_owned()) - .header(HEADER_TOKEN, token) - .protobuf(params)? - .option_response() - .await?; - - Ok(view) +pub async fn read_view_request(_token: &str, _params: ViewId, _url: &str) -> Result, ServerError> { + // let view = request_builder() + // .get(&url.to_owned()) + // .header(HEADER_TOKEN, token) + // .protobuf(params)? + // .option_response() + // .await?; + // + // Ok(view) + unimplemented!() } pub async fn update_view_request(token: &str, params: UpdateViewParams, url: &str) -> Result<(), ServerError> { @@ -328,13 +347,14 @@ pub async fn delete_trash_request(token: &str, params: RepeatedTrashId, url: &st Ok(()) } -pub async fn read_trash_request(token: &str, url: &str) -> Result { - let repeated_trash = request_builder() - .get(&url.to_owned()) - .header(HEADER_TOKEN, token) - .response::() - .await?; - Ok(repeated_trash) +pub async fn read_trash_request(_token: &str, _url: &str) -> Result, ServerError> { + // let repeated_trash = request_builder() + // .get(&url.to_owned()) + // .header(HEADER_TOKEN, token) + // .response::() + // .await?; + // Ok(repeated_trash) + unimplemented!() } lazy_static! { diff --git a/frontend/rust-lib/flowy-net/src/local_server/server.rs b/frontend/rust-lib/flowy-net/src/local_server/server.rs index c9a6d20cf3..87f4f46f4e 100644 --- a/frontend/rust-lib/flowy-net/src/local_server/server.rs +++ b/frontend/rust-lib/flowy-net/src/local_server/server.rs @@ -255,11 +255,12 @@ impl RevisionUser for LocalRevisionUser { use flowy_folder_data_model::entities::app::gen_app_id; use flowy_folder_data_model::entities::workspace::gen_workspace_id; use flowy_folder_data_model::entities::{ - app::{App, AppId, CreateAppParams, RepeatedApp, UpdateAppParams}, - trash::{RepeatedTrash, RepeatedTrashId}, - view::{CreateViewParams, RepeatedView, RepeatedViewId, UpdateViewParams, View, ViewId}, - workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceId}, + app::{AppId, CreateAppParams, UpdateAppParams}, + trash::RepeatedTrashId, + view::{CreateViewParams, RepeatedViewId, UpdateViewParams, ViewId}, + workspace::{CreateWorkspaceParams, UpdateWorkspaceParams, WorkspaceId}, }; +use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use flowy_text_block::BlockCloudService; use flowy_user::event_map::UserCloudService; use flowy_user_data_model::entities::{ @@ -270,13 +271,17 @@ use lib_infra::{future::FutureResult, util::timestamp}; impl FolderCouldServiceV1 for LocalServer { fn init(&self) {} - fn create_workspace(&self, _token: &str, params: CreateWorkspaceParams) -> FutureResult { + fn create_workspace( + &self, + _token: &str, + params: CreateWorkspaceParams, + ) -> FutureResult { let time = timestamp(); - let workspace = Workspace { + let workspace = WorkspaceRevision { id: gen_workspace_id(), name: params.name, desc: params.desc, - apps: RepeatedApp::default(), + apps: vec![], modified_time: time, create_time: time, }; @@ -284,11 +289,8 @@ impl FolderCouldServiceV1 for LocalServer { FutureResult::new(async { Ok(workspace) }) } - fn read_workspace(&self, _token: &str, _params: WorkspaceId) -> FutureResult { - FutureResult::new(async { - let repeated_workspace = RepeatedWorkspace { items: vec![] }; - Ok(repeated_workspace) - }) + fn read_workspace(&self, _token: &str, _params: WorkspaceId) -> FutureResult, FlowyError> { + FutureResult::new(async { Ok(vec![]) }) } fn update_workspace(&self, _token: &str, _params: UpdateWorkspaceParams) -> FutureResult<(), FlowyError> { @@ -299,16 +301,16 @@ impl FolderCouldServiceV1 for LocalServer { FutureResult::new(async { Ok(()) }) } - fn create_view(&self, _token: &str, params: CreateViewParams) -> FutureResult { + fn create_view(&self, _token: &str, params: CreateViewParams) -> FutureResult { let time = timestamp(); - let view = View { + let view = ViewRevision { id: params.view_id, belong_to_id: params.belong_to_id, name: params.name, desc: params.desc, data_type: params.data_type, version: 0, - belongings: RepeatedView::default(), + belongings: vec![], modified_time: time, create_time: time, ext_data: "".to_string(), @@ -318,7 +320,7 @@ impl FolderCouldServiceV1 for LocalServer { FutureResult::new(async { Ok(view) }) } - fn read_view(&self, _token: &str, _params: ViewId) -> FutureResult, FlowyError> { + fn read_view(&self, _token: &str, _params: ViewId) -> FutureResult, FlowyError> { FutureResult::new(async { Ok(None) }) } @@ -330,14 +332,14 @@ impl FolderCouldServiceV1 for LocalServer { FutureResult::new(async { Ok(()) }) } - fn create_app(&self, _token: &str, params: CreateAppParams) -> FutureResult { + fn create_app(&self, _token: &str, params: CreateAppParams) -> FutureResult { let time = timestamp(); - let app = App { + let app = AppRevision { id: gen_app_id(), workspace_id: params.workspace_id, name: params.name, desc: params.desc, - belongings: RepeatedView::default(), + belongings: vec![], version: 0, modified_time: time, create_time: time, @@ -345,7 +347,7 @@ impl FolderCouldServiceV1 for LocalServer { FutureResult::new(async { Ok(app) }) } - fn read_app(&self, _token: &str, _params: AppId) -> FutureResult, FlowyError> { + fn read_app(&self, _token: &str, _params: AppId) -> FutureResult, FlowyError> { FutureResult::new(async { Ok(None) }) } @@ -365,17 +367,14 @@ impl FolderCouldServiceV1 for LocalServer { FutureResult::new(async { Ok(()) }) } - fn read_trash(&self, _token: &str) -> FutureResult { - FutureResult::new(async { - let repeated_trash = RepeatedTrash { items: vec![] }; - Ok(repeated_trash) - }) + fn read_trash(&self, _token: &str) -> FutureResult, FlowyError> { + FutureResult::new(async { Ok(vec![]) }) } } impl UserCloudService for LocalServer { fn sign_up(&self, params: SignUpParams) -> FutureResult { - let uid = nanoid!(10); + let uid = nanoid!(20); FutureResult::new(async move { Ok(SignUpResponse { user_id: uid.clone(), @@ -387,7 +386,7 @@ impl UserCloudService for LocalServer { } fn sign_in(&self, params: SignInParams) -> FutureResult { - let user_id = nanoid!(10); + let user_id = nanoid!(20); FutureResult::new(async { Ok(SignInResponse { user_id: user_id.clone(), diff --git a/frontend/rust-lib/flowy-test/src/helper.rs b/frontend/rust-lib/flowy-test/src/helper.rs index d840069ca0..2bb9622914 100644 --- a/frontend/rust-lib/flowy-test/src/helper.rs +++ b/frontend/rust-lib/flowy-test/src/helper.rs @@ -126,7 +126,7 @@ pub fn root_dir() -> String { } pub fn random_email() -> String { - format!("{}@appflowy.io", nanoid!(10)) + format!("{}@appflowy.io", nanoid!(20)) } pub fn login_email() -> String { @@ -163,8 +163,9 @@ pub fn sign_up(dispatch: Arc) -> SignUpContext { pub async fn async_sign_up(dispatch: Arc) -> SignUpContext { let password = login_password(); + let email = random_email(); let payload = SignUpPayload { - email: random_email(), + email, name: "app flowy".to_string(), password: password.clone(), } diff --git a/frontend/rust-lib/flowy-user/src/services/database.rs b/frontend/rust-lib/flowy-user/src/services/database.rs index f3ddf48fa5..f46d86ad5e 100644 --- a/frontend/rust-lib/flowy-user/src/services/database.rs +++ b/frontend/rust-lib/flowy-user/src/services/database.rs @@ -3,8 +3,7 @@ use flowy_database::{schema::user_table, DBConnection, Database}; use flowy_error::{ErrorCode, FlowyError}; use flowy_user_data_model::entities::{SignInResponse, SignUpResponse, UpdateUserParams, UserProfile}; use lazy_static::lazy_static; -use once_cell::sync::Lazy; -use parking_lot::{Mutex, RwLock}; +use parking_lot::RwLock; use std::{collections::HashMap, sync::Arc, time::Duration}; lazy_static! { @@ -22,32 +21,38 @@ impl UserDB { } } - fn open_user_db(&self, user_id: &str) -> Result<(), FlowyError> { + fn open_user_db_if_need(&self, user_id: &str) -> Result, FlowyError> { if user_id.is_empty() { return Err(ErrorCode::UserIdIsEmpty.into()); } + if let Some(database) = DB_MAP.read().get(user_id) { + return Ok(database.get_pool()); + } + + let mut write_guard = DB_MAP.write(); + // The Write guard acquire exclusive access that will guarantee the user db only initialize once. + match write_guard.get(user_id) { + None => {} + Some(database) => return Ok(database.get_pool()), + } + tracing::trace!("open user db {}", user_id); let dir = format!("{}/{}", self.db_dir, user_id); let db = flowy_database::init(&dir).map_err(|e| { - log::error!("init user db failed, {:?}, user_id: {}", e, user_id); + log::error!("open user: {} db failed, {:?}", user_id, e); FlowyError::internal().context(e) })?; - - match DB_MAP.try_write_for(Duration::from_millis(300)) { - None => Err(FlowyError::internal().context("Acquire write lock to save user db failed")), - Some(mut write_guard) => { - write_guard.insert(user_id.to_owned(), db); - Ok(()) - } - } + let pool = db.get_pool(); + write_guard.insert(user_id.to_owned(), db); + drop(write_guard); + Ok(pool) } pub(crate) fn close_user_db(&self, user_id: &str) -> Result<(), FlowyError> { match DB_MAP.try_write_for(Duration::from_millis(300)) { None => Err(FlowyError::internal().context("Acquire write lock to close user db failed")), Some(mut write_guard) => { - set_user_db_init(false, user_id); write_guard.remove(user_id); Ok(()) } @@ -60,27 +65,8 @@ impl UserDB { } pub(crate) fn get_pool(&self, user_id: &str) -> Result, FlowyError> { - // Opti: INIT_LOCK try to lock the INIT_RECORD accesses. Because the write guard - // can not nested in the read guard that will cause the deadlock. - match INIT_LOCK.try_lock_for(Duration::from_millis(300)) { - None => log::error!("get_pool fail"), - Some(_) => { - if !is_user_db_init(user_id) { - let _ = self.open_user_db(user_id)?; - set_user_db_init(true, user_id); - } - } - } - - match DB_MAP.try_read_for(Duration::from_millis(300)) { - None => Err(FlowyError::internal().context("Acquire read lock to read user db failed")), - Some(read_guard) => match read_guard.get(user_id) { - None => { - Err(FlowyError::internal().context("Get connection failed. The database is not initialization")) - } - Some(database) => Ok(database.get_pool()), - }, - } + let pool = self.open_user_db_if_need(user_id)?; + Ok(pool) } } @@ -88,20 +74,6 @@ lazy_static! { static ref DB_MAP: RwLock> = RwLock::new(HashMap::new()); } -static INIT_LOCK: Lazy> = Lazy::new(|| Mutex::new(())); -static INIT_RECORD: Lazy>> = Lazy::new(|| Mutex::new(HashMap::new())); -fn set_user_db_init(is_init: bool, user_id: &str) { - let mut record = INIT_RECORD.lock(); - record.insert(user_id.to_owned(), is_init); -} - -fn is_user_db_init(user_id: &str) -> bool { - match INIT_RECORD.lock().get(user_id) { - None => false, - Some(flag) => *flag, - } -} - #[derive(Clone, Default, Queryable, Identifiable, Insertable)] #[table_name = "user_table"] pub struct UserTable { diff --git a/shared-lib/flowy-folder-data-model/src/entities/app.rs b/shared-lib/flowy-folder-data-model/src/entities/app.rs index cdf4c8fa69..87983320d2 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/app.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/app.rs @@ -15,7 +15,7 @@ use std::convert::TryInto; pub fn gen_app_id() -> String { nanoid!(10) } -#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone)] +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] pub struct App { #[pb(index = 1)] pub id: String, diff --git a/shared-lib/flowy-folder-data-model/src/entities/trash.rs b/shared-lib/flowy-folder-data-model/src/entities/trash.rs index bd9d101cb4..68b3d0a26e 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/trash.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/trash.rs @@ -1,4 +1,5 @@ -use crate::{entities::app::App, impl_def_and_def_mut}; +use crate::impl_def_and_def_mut; +use crate::revision::TrashRevision; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use serde::{Deserialize, Serialize}; use std::fmt::Formatter; @@ -29,18 +30,6 @@ pub struct RepeatedTrash { impl_def_and_def_mut!(RepeatedTrash, Trash); -impl std::convert::From for Trash { - fn from(app: App) -> Self { - Trash { - id: app.id, - name: app.name, - modified_time: app.modified_time, - create_time: app.create_time, - ty: TrashType::TrashApp, - } - } -} - #[derive(Eq, PartialEq, Debug, ProtoBuf_Enum, Clone, Serialize, Deserialize)] pub enum TrashType { Unknown = 0, @@ -103,8 +92,8 @@ impl std::convert::From> for RepeatedTrashId { } } -impl std::convert::From> for RepeatedTrashId { - fn from(trash: Vec) -> Self { +impl std::convert::From> for RepeatedTrashId { + fn from(trash: Vec) -> Self { let items = trash .into_iter() .map(|t| TrashId { id: t.id, ty: t.ty }) @@ -126,15 +115,6 @@ pub struct TrashId { pub ty: TrashType, } -impl std::convert::From<&Trash> for TrashId { - fn from(trash: &Trash) -> Self { - TrashId { - id: trash.id.clone(), - ty: trash.ty.clone(), - } - } -} - impl std::fmt::Display for TrashId { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_str(&format!("{:?}:{}", self.ty, self.id)) diff --git a/shared-lib/flowy-folder-data-model/src/entities/view.rs b/shared-lib/flowy-folder-data-model/src/entities/view.rs index 7b29bd6c37..affe373caf 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/view.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/view.rs @@ -1,5 +1,4 @@ use crate::{ - entities::trash::{Trash, TrashType}, errors::ErrorCode, impl_def_and_def_mut, parser::{ @@ -17,7 +16,7 @@ pub fn gen_view_id() -> String { nanoid!(10) } -#[derive(Eq, PartialEq, ProtoBuf, Default, Debug, Clone)] +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] pub struct View { #[pb(index = 1)] pub id: String, @@ -28,6 +27,30 @@ pub struct View { #[pb(index = 3)] pub name: String, + #[pb(index = 4)] + pub data_type: ViewDataType, + + #[pb(index = 5)] + pub modified_time: i64, + + #[pb(index = 6)] + pub create_time: i64, + + #[pb(index = 7)] + pub plugin_type: i32, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewInfo { + #[pb(index = 1)] + pub id: String, + + #[pb(index = 2)] + pub belong_to_id: String, + + #[pb(index = 3)] + pub name: String, + #[pb(index = 4)] pub desc: String, @@ -35,25 +58,43 @@ pub struct View { pub data_type: ViewDataType, #[pb(index = 6)] - pub version: i64, - - #[pb(index = 7)] pub belongings: RepeatedView, - #[pb(index = 8)] - pub modified_time: i64, + #[pb(index = 7)] + pub ext_data: ViewExtData, +} - #[pb(index = 9)] - pub create_time: i64, +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewExtData { + #[pb(index = 1)] + pub filter: ViewFilter, - #[pb(index = 10)] - pub ext_data: String, + #[pb(index = 2)] + pub group: ViewGroup, - #[pb(index = 11)] - pub thumbnail: String, + #[pb(index = 3)] + pub sort: ViewSort, +} - #[pb(index = 12)] - pub plugin_type: i32, +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewFilter { + #[pb(index = 1)] + pub field_id: String, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewGroup { + #[pb(index = 1)] + pub group_field_id: String, + + #[pb(index = 2, one_of)] + pub sub_group_field_id: Option, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewSort { + #[pb(index = 1)] + pub field_id: String, } #[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)] @@ -65,18 +106,6 @@ pub struct RepeatedView { impl_def_and_def_mut!(RepeatedView, View); -impl std::convert::From for Trash { - fn from(view: View) -> Self { - Trash { - id: view.id, - name: view.name, - modified_time: view.modified_time, - create_time: view.create_time, - ty: TrashType::TrashView, - } - } -} - #[derive(Eq, PartialEq, Hash, Debug, ProtoBuf_Enum, Clone, Serialize_repr, Deserialize_repr)] #[repr(u8)] pub enum ViewDataType { diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs b/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs index 3b119c3bc1..2954cfa693 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs +++ b/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs @@ -29,14 +29,9 @@ pub struct View { pub id: ::std::string::String, pub belong_to_id: ::std::string::String, pub name: ::std::string::String, - pub desc: ::std::string::String, pub data_type: ViewDataType, - pub version: i64, - pub belongings: ::protobuf::SingularPtrField, pub modified_time: i64, pub create_time: i64, - pub ext_data: ::std::string::String, - pub thumbnail: ::std::string::String, pub plugin_type: i32, // special fields pub unknown_fields: ::protobuf::UnknownFields, @@ -109,6 +104,385 @@ impl View { // string name = 3; + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // .ViewDataType data_type = 4; + + + pub fn get_data_type(&self) -> ViewDataType { + self.data_type + } + pub fn clear_data_type(&mut self) { + self.data_type = ViewDataType::TextBlock; + } + + // Param is passed by value, moved + pub fn set_data_type(&mut self, v: ViewDataType) { + self.data_type = v; + } + + // int64 modified_time = 5; + + + pub fn get_modified_time(&self) -> i64 { + self.modified_time + } + pub fn clear_modified_time(&mut self) { + self.modified_time = 0; + } + + // Param is passed by value, moved + pub fn set_modified_time(&mut self, v: i64) { + self.modified_time = v; + } + + // int64 create_time = 6; + + + pub fn get_create_time(&self) -> i64 { + self.create_time + } + pub fn clear_create_time(&mut self) { + self.create_time = 0; + } + + // Param is passed by value, moved + pub fn set_create_time(&mut self, v: i64) { + self.create_time = v; + } + + // int32 plugin_type = 7; + + + pub fn get_plugin_type(&self) -> i32 { + self.plugin_type + } + pub fn clear_plugin_type(&mut self) { + self.plugin_type = 0; + } + + // Param is passed by value, moved + pub fn set_plugin_type(&mut self, v: i32) { + self.plugin_type = v; + } +} + +impl ::protobuf::Message for View { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.belong_to_id)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 4 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.data_type, 4, &mut self.unknown_fields)? + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.modified_time = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.create_time = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.plugin_type = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.id); + } + if !self.belong_to_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.belong_to_id); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.name); + } + if self.data_type != ViewDataType::TextBlock { + my_size += ::protobuf::rt::enum_size(4, self.data_type); + } + if self.modified_time != 0 { + my_size += ::protobuf::rt::value_size(5, self.modified_time, ::protobuf::wire_format::WireTypeVarint); + } + if self.create_time != 0 { + my_size += ::protobuf::rt::value_size(6, self.create_time, ::protobuf::wire_format::WireTypeVarint); + } + if self.plugin_type != 0 { + my_size += ::protobuf::rt::value_size(7, self.plugin_type, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.id.is_empty() { + os.write_string(1, &self.id)?; + } + if !self.belong_to_id.is_empty() { + os.write_string(2, &self.belong_to_id)?; + } + if !self.name.is_empty() { + os.write_string(3, &self.name)?; + } + if self.data_type != ViewDataType::TextBlock { + os.write_enum(4, ::protobuf::ProtobufEnum::value(&self.data_type))?; + } + if self.modified_time != 0 { + os.write_int64(5, self.modified_time)?; + } + if self.create_time != 0 { + os.write_int64(6, self.create_time)?; + } + if self.plugin_type != 0 { + os.write_int32(7, self.plugin_type)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> View { + View::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "id", + |m: &View| { &m.id }, + |m: &mut View| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "belong_to_id", + |m: &View| { &m.belong_to_id }, + |m: &mut View| { &mut m.belong_to_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &View| { &m.name }, + |m: &mut View| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "data_type", + |m: &View| { &m.data_type }, + |m: &mut View| { &mut m.data_type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "modified_time", + |m: &View| { &m.modified_time }, + |m: &mut View| { &mut m.modified_time }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "create_time", + |m: &View| { &m.create_time }, + |m: &mut View| { &mut m.create_time }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "plugin_type", + |m: &View| { &m.plugin_type }, + |m: &mut View| { &mut m.plugin_type }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "View", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static View { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(View::new) + } +} + +impl ::protobuf::Clear for View { + fn clear(&mut self) { + self.id.clear(); + self.belong_to_id.clear(); + self.name.clear(); + self.data_type = ViewDataType::TextBlock; + self.modified_time = 0; + self.create_time = 0; + self.plugin_type = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for View { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for View { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewInfo { + // message fields + pub id: ::std::string::String, + pub belong_to_id: ::std::string::String, + pub name: ::std::string::String, + pub desc: ::std::string::String, + pub data_type: ViewDataType, + pub belongings: ::protobuf::SingularPtrField, + pub ext_data: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewInfo { + fn default() -> &'a ViewInfo { + ::default_instance() + } +} + +impl ViewInfo { + pub fn new() -> ViewInfo { + ::std::default::Default::default() + } + + // string id = 1; + + + pub fn get_id(&self) -> &str { + &self.id + } + pub fn clear_id(&mut self) { + self.id.clear(); + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::string::String) { + self.id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::string::String { + &mut self.id + } + + // Take field + pub fn take_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.id, ::std::string::String::new()) + } + + // string belong_to_id = 2; + + + pub fn get_belong_to_id(&self) -> &str { + &self.belong_to_id + } + pub fn clear_belong_to_id(&mut self) { + self.belong_to_id.clear(); + } + + // Param is passed by value, moved + pub fn set_belong_to_id(&mut self, v: ::std::string::String) { + self.belong_to_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_belong_to_id(&mut self) -> &mut ::std::string::String { + &mut self.belong_to_id + } + + // Take field + pub fn take_belong_to_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.belong_to_id, ::std::string::String::new()) + } + + // string name = 3; + + pub fn get_name(&self) -> &str { &self.name } @@ -173,22 +547,7 @@ impl View { self.data_type = v; } - // int64 version = 6; - - - pub fn get_version(&self) -> i64 { - self.version - } - pub fn clear_version(&mut self) { - self.version = 0; - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: i64) { - self.version = v; - } - - // .RepeatedView belongings = 7; + // .RepeatedView belongings = 6; pub fn get_belongings(&self) -> &RepeatedView { @@ -221,111 +580,52 @@ impl View { self.belongings.take().unwrap_or_else(|| RepeatedView::new()) } - // int64 modified_time = 8; + // .ViewExtData ext_data = 7; - pub fn get_modified_time(&self) -> i64 { - self.modified_time - } - pub fn clear_modified_time(&mut self) { - self.modified_time = 0; - } - - // Param is passed by value, moved - pub fn set_modified_time(&mut self, v: i64) { - self.modified_time = v; - } - - // int64 create_time = 9; - - - pub fn get_create_time(&self) -> i64 { - self.create_time - } - pub fn clear_create_time(&mut self) { - self.create_time = 0; - } - - // Param is passed by value, moved - pub fn set_create_time(&mut self, v: i64) { - self.create_time = v; - } - - // string ext_data = 10; - - - pub fn get_ext_data(&self) -> &str { - &self.ext_data + pub fn get_ext_data(&self) -> &ViewExtData { + self.ext_data.as_ref().unwrap_or_else(|| ::default_instance()) } pub fn clear_ext_data(&mut self) { self.ext_data.clear(); } + pub fn has_ext_data(&self) -> bool { + self.ext_data.is_some() + } + // Param is passed by value, moved - pub fn set_ext_data(&mut self, v: ::std::string::String) { - self.ext_data = v; + pub fn set_ext_data(&mut self, v: ViewExtData) { + self.ext_data = ::protobuf::SingularPtrField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_ext_data(&mut self) -> &mut ::std::string::String { - &mut self.ext_data + pub fn mut_ext_data(&mut self) -> &mut ViewExtData { + if self.ext_data.is_none() { + self.ext_data.set_default(); + } + self.ext_data.as_mut().unwrap() } // Take field - pub fn take_ext_data(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.ext_data, ::std::string::String::new()) - } - - // string thumbnail = 11; - - - pub fn get_thumbnail(&self) -> &str { - &self.thumbnail - } - pub fn clear_thumbnail(&mut self) { - self.thumbnail.clear(); - } - - // Param is passed by value, moved - pub fn set_thumbnail(&mut self, v: ::std::string::String) { - self.thumbnail = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_thumbnail(&mut self) -> &mut ::std::string::String { - &mut self.thumbnail - } - - // Take field - pub fn take_thumbnail(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.thumbnail, ::std::string::String::new()) - } - - // int32 plugin_type = 12; - - - pub fn get_plugin_type(&self) -> i32 { - self.plugin_type - } - pub fn clear_plugin_type(&mut self) { - self.plugin_type = 0; - } - - // Param is passed by value, moved - pub fn set_plugin_type(&mut self, v: i32) { - self.plugin_type = v; + pub fn take_ext_data(&mut self) -> ViewExtData { + self.ext_data.take().unwrap_or_else(|| ViewExtData::new()) } } -impl ::protobuf::Message for View { +impl ::protobuf::Message for ViewInfo { fn is_initialized(&self) -> bool { for v in &self.belongings { if !v.is_initialized() { return false; } }; + for v in &self.ext_data { + if !v.is_initialized() { + return false; + } + }; true } @@ -349,41 +649,10 @@ impl ::protobuf::Message for View { ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.data_type, 5, &mut self.unknown_fields)? }, 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int64()?; - self.version = tmp; - }, - 7 => { ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.belongings)?; }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int64()?; - self.modified_time = tmp; - }, - 9 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int64()?; - self.create_time = tmp; - }, - 10 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.ext_data)?; - }, - 11 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.thumbnail)?; - }, - 12 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int32()?; - self.plugin_type = tmp; + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.ext_data)?; }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -412,27 +681,13 @@ impl ::protobuf::Message for View { if self.data_type != ViewDataType::TextBlock { my_size += ::protobuf::rt::enum_size(5, self.data_type); } - if self.version != 0 { - my_size += ::protobuf::rt::value_size(6, self.version, ::protobuf::wire_format::WireTypeVarint); - } if let Some(ref v) = self.belongings.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; } - if self.modified_time != 0 { - my_size += ::protobuf::rt::value_size(8, self.modified_time, ::protobuf::wire_format::WireTypeVarint); - } - if self.create_time != 0 { - my_size += ::protobuf::rt::value_size(9, self.create_time, ::protobuf::wire_format::WireTypeVarint); - } - if !self.ext_data.is_empty() { - my_size += ::protobuf::rt::string_size(10, &self.ext_data); - } - if !self.thumbnail.is_empty() { - my_size += ::protobuf::rt::string_size(11, &self.thumbnail); - } - if self.plugin_type != 0 { - my_size += ::protobuf::rt::value_size(12, self.plugin_type, ::protobuf::wire_format::WireTypeVarint); + if let Some(ref v) = self.ext_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); @@ -455,28 +710,15 @@ impl ::protobuf::Message for View { if self.data_type != ViewDataType::TextBlock { os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.data_type))?; } - if self.version != 0 { - os.write_int64(6, self.version)?; - } if let Some(ref v) = self.belongings.as_ref() { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; v.write_to_with_cached_sizes(os)?; } - if self.modified_time != 0 { - os.write_int64(8, self.modified_time)?; - } - if self.create_time != 0 { - os.write_int64(9, self.create_time)?; - } - if !self.ext_data.is_empty() { - os.write_string(10, &self.ext_data)?; - } - if !self.thumbnail.is_empty() { - os.write_string(11, &self.thumbnail)?; - } - if self.plugin_type != 0 { - os.write_int32(12, self.plugin_type)?; + if let Some(ref v) = self.ext_data.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) @@ -508,8 +750,8 @@ impl ::protobuf::Message for View { Self::descriptor_static() } - fn new() -> View { - View::new() + fn new() -> ViewInfo { + ViewInfo::new() } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { @@ -518,103 +760,920 @@ impl ::protobuf::Message for View { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "id", - |m: &View| { &m.id }, - |m: &mut View| { &mut m.id }, + |m: &ViewInfo| { &m.id }, + |m: &mut ViewInfo| { &mut m.id }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "belong_to_id", - |m: &View| { &m.belong_to_id }, - |m: &mut View| { &mut m.belong_to_id }, + |m: &ViewInfo| { &m.belong_to_id }, + |m: &mut ViewInfo| { &mut m.belong_to_id }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - |m: &View| { &m.name }, - |m: &mut View| { &mut m.name }, + |m: &ViewInfo| { &m.name }, + |m: &mut ViewInfo| { &mut m.name }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "desc", - |m: &View| { &m.desc }, - |m: &mut View| { &mut m.desc }, + |m: &ViewInfo| { &m.desc }, + |m: &mut ViewInfo| { &mut m.desc }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "data_type", - |m: &View| { &m.data_type }, - |m: &mut View| { &mut m.data_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( - "version", - |m: &View| { &m.version }, - |m: &mut View| { &mut m.version }, + |m: &ViewInfo| { &m.data_type }, + |m: &mut ViewInfo| { &mut m.data_type }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "belongings", - |m: &View| { &m.belongings }, - |m: &mut View| { &mut m.belongings }, + |m: &ViewInfo| { &m.belongings }, + |m: &mut ViewInfo| { &mut m.belongings }, )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( - "modified_time", - |m: &View| { &m.modified_time }, - |m: &mut View| { &mut m.modified_time }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( - "create_time", - |m: &View| { &m.create_time }, - |m: &mut View| { &mut m.create_time }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "ext_data", - |m: &View| { &m.ext_data }, - |m: &mut View| { &mut m.ext_data }, + |m: &ViewInfo| { &m.ext_data }, + |m: &mut ViewInfo| { &mut m.ext_data }, )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "thumbnail", - |m: &View| { &m.thumbnail }, - |m: &mut View| { &mut m.thumbnail }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( - "plugin_type", - |m: &View| { &m.plugin_type }, - |m: &mut View| { &mut m.plugin_type }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "View", + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewInfo", fields, file_descriptor_proto() ) }) } - fn default_instance() -> &'static View { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(View::new) + fn default_instance() -> &'static ViewInfo { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewInfo::new) } } -impl ::protobuf::Clear for View { +impl ::protobuf::Clear for ViewInfo { fn clear(&mut self) { self.id.clear(); self.belong_to_id.clear(); self.name.clear(); self.desc.clear(); self.data_type = ViewDataType::TextBlock; - self.version = 0; self.belongings.clear(); - self.modified_time = 0; - self.create_time = 0; self.ext_data.clear(); - self.thumbnail.clear(); - self.plugin_type = 0; self.unknown_fields.clear(); } } -impl ::std::fmt::Debug for View { +impl ::std::fmt::Debug for ViewInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } -impl ::protobuf::reflect::ProtobufValue for View { +impl ::protobuf::reflect::ProtobufValue for ViewInfo { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewExtData { + // message fields + pub filter: ::protobuf::SingularPtrField, + pub group: ::protobuf::SingularPtrField, + pub sort: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewExtData { + fn default() -> &'a ViewExtData { + ::default_instance() + } +} + +impl ViewExtData { + pub fn new() -> ViewExtData { + ::std::default::Default::default() + } + + // .ViewFilter filter = 1; + + + pub fn get_filter(&self) -> &ViewFilter { + self.filter.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_filter(&mut self) { + self.filter.clear(); + } + + pub fn has_filter(&self) -> bool { + self.filter.is_some() + } + + // Param is passed by value, moved + pub fn set_filter(&mut self, v: ViewFilter) { + self.filter = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_filter(&mut self) -> &mut ViewFilter { + if self.filter.is_none() { + self.filter.set_default(); + } + self.filter.as_mut().unwrap() + } + + // Take field + pub fn take_filter(&mut self) -> ViewFilter { + self.filter.take().unwrap_or_else(|| ViewFilter::new()) + } + + // .ViewGroup group = 2; + + + pub fn get_group(&self) -> &ViewGroup { + self.group.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_group(&mut self) { + self.group.clear(); + } + + pub fn has_group(&self) -> bool { + self.group.is_some() + } + + // Param is passed by value, moved + pub fn set_group(&mut self, v: ViewGroup) { + self.group = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_group(&mut self) -> &mut ViewGroup { + if self.group.is_none() { + self.group.set_default(); + } + self.group.as_mut().unwrap() + } + + // Take field + pub fn take_group(&mut self) -> ViewGroup { + self.group.take().unwrap_or_else(|| ViewGroup::new()) + } + + // .ViewSort sort = 3; + + + pub fn get_sort(&self) -> &ViewSort { + self.sort.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_sort(&mut self) { + self.sort.clear(); + } + + pub fn has_sort(&self) -> bool { + self.sort.is_some() + } + + // Param is passed by value, moved + pub fn set_sort(&mut self, v: ViewSort) { + self.sort = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sort(&mut self) -> &mut ViewSort { + if self.sort.is_none() { + self.sort.set_default(); + } + self.sort.as_mut().unwrap() + } + + // Take field + pub fn take_sort(&mut self) -> ViewSort { + self.sort.take().unwrap_or_else(|| ViewSort::new()) + } +} + +impl ::protobuf::Message for ViewExtData { + fn is_initialized(&self) -> bool { + for v in &self.filter { + if !v.is_initialized() { + return false; + } + }; + for v in &self.group { + if !v.is_initialized() { + return false; + } + }; + for v in &self.sort { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.filter)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.group)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.sort)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.filter.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.group.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.sort.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.filter.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.group.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.sort.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewExtData { + ViewExtData::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "filter", + |m: &ViewExtData| { &m.filter }, + |m: &mut ViewExtData| { &mut m.filter }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "group", + |m: &ViewExtData| { &m.group }, + |m: &mut ViewExtData| { &mut m.group }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "sort", + |m: &ViewExtData| { &m.sort }, + |m: &mut ViewExtData| { &mut m.sort }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewExtData", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewExtData { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewExtData::new) + } +} + +impl ::protobuf::Clear for ViewExtData { + fn clear(&mut self) { + self.filter.clear(); + self.group.clear(); + self.sort.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewExtData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewExtData { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewFilter { + // message fields + pub field_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewFilter { + fn default() -> &'a ViewFilter { + ::default_instance() + } +} + +impl ViewFilter { + pub fn new() -> ViewFilter { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for ViewFilter { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.field_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.field_id.is_empty() { + os.write_string(1, &self.field_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewFilter { + ViewFilter::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &ViewFilter| { &m.field_id }, + |m: &mut ViewFilter| { &mut m.field_id }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewFilter", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewFilter { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewFilter::new) + } +} + +impl ::protobuf::Clear for ViewFilter { + fn clear(&mut self) { + self.field_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewFilter { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewFilter { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewGroup { + // message fields + pub group_field_id: ::std::string::String, + // message oneof groups + pub one_of_sub_group_field_id: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewGroup { + fn default() -> &'a ViewGroup { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum ViewGroup_oneof_one_of_sub_group_field_id { + sub_group_field_id(::std::string::String), +} + +impl ViewGroup { + pub fn new() -> ViewGroup { + ::std::default::Default::default() + } + + // string group_field_id = 1; + + + pub fn get_group_field_id(&self) -> &str { + &self.group_field_id + } + pub fn clear_group_field_id(&mut self) { + self.group_field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_group_field_id(&mut self, v: ::std::string::String) { + self.group_field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_group_field_id(&mut self) -> &mut ::std::string::String { + &mut self.group_field_id + } + + // Take field + pub fn take_group_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.group_field_id, ::std::string::String::new()) + } + + // string sub_group_field_id = 2; + + + pub fn get_sub_group_field_id(&self) -> &str { + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_sub_group_field_id(&mut self) { + self.one_of_sub_group_field_id = ::std::option::Option::None; + } + + pub fn has_sub_group_field_id(&self) -> bool { + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_sub_group_field_id(&mut self, v: ::std::string::String) { + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_sub_group_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(_)) = self.one_of_sub_group_field_id { + } else { + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(::std::string::String::new())); + } + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_sub_group_field_id(&mut self) -> ::std::string::String { + if self.has_sub_group_field_id() { + match self.one_of_sub_group_field_id.take() { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } +} + +impl ::protobuf::Message for ViewGroup { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.group_field_id)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(is.read_string()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.group_field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.group_field_id); + } + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + match v { + &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + my_size += ::protobuf::rt::string_size(2, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.group_field_id.is_empty() { + os.write_string(1, &self.group_field_id)?; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + match v { + &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + os.write_string(2, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewGroup { + ViewGroup::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "group_field_id", + |m: &ViewGroup| { &m.group_field_id }, + |m: &mut ViewGroup| { &mut m.group_field_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "sub_group_field_id", + ViewGroup::has_sub_group_field_id, + ViewGroup::get_sub_group_field_id, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewGroup", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewGroup { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewGroup::new) + } +} + +impl ::protobuf::Clear for ViewGroup { + fn clear(&mut self) { + self.group_field_id.clear(); + self.one_of_sub_group_field_id = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewGroup { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewGroup { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewSort { + // message fields + pub field_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewSort { + fn default() -> &'a ViewSort { + ::default_instance() + } +} + +impl ViewSort { + pub fn new() -> ViewSort { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for ViewSort { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.field_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.field_id.is_empty() { + os.write_string(1, &self.field_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewSort { + ViewSort::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &ViewSort| { &m.field_id }, + |m: &mut ViewSort| { &mut m.field_id }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewSort", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewSort { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewSort::new) + } +} + +impl ::protobuf::Clear for ViewSort { + fn clear(&mut self) { + self.field_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewSort { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewSort { fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { ::protobuf::reflect::ReflectValueRef::Message(self) } @@ -3138,46 +4197,56 @@ impl ::protobuf::reflect::ProtobufValue for MoveFolderItemType { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\nview.proto\"\xf5\x02\n\x04View\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\ + \n\nview.proto\"\xdf\x01\n\x04View\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\ \x02id\x12\x20\n\x0cbelong_to_id\x18\x02\x20\x01(\tR\nbelongToId\x12\x12\ - \n\x04name\x18\x03\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x04\x20\x01\ - (\tR\x04desc\x12*\n\tdata_type\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08\ - dataType\x12\x18\n\x07version\x18\x06\x20\x01(\x03R\x07version\x12-\n\nb\ - elongings\x18\x07\x20\x01(\x0b2\r.RepeatedViewR\nbelongings\x12#\n\rmodi\ - fied_time\x18\x08\x20\x01(\x03R\x0cmodifiedTime\x12\x1f\n\x0bcreate_time\ - \x18\t\x20\x01(\x03R\ncreateTime\x12\x19\n\x08ext_data\x18\n\x20\x01(\tR\ - \x07extData\x12\x1c\n\tthumbnail\x18\x0b\x20\x01(\tR\tthumbnail\x12\x1f\ - \n\x0bplugin_type\x18\x0c\x20\x01(\x05R\npluginType\"+\n\x0cRepeatedView\ - \x12\x1b\n\x05items\x18\x01\x20\x03(\x0b2\x05.ViewR\x05items\"\xf2\x01\n\ - \x11CreateViewPayload\x12\x20\n\x0cbelong_to_id\x18\x01\x20\x01(\tR\nbel\ - ongToId\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\ - \x18\x03\x20\x01(\tR\x04desc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\0R\ - \tthumbnail\x12*\n\tdata_type\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08d\ - ataType\x12\x1f\n\x0bplugin_type\x18\x06\x20\x01(\x05R\npluginType\x12\ - \x12\n\x04data\x18\x07\x20\x01(\x0cR\x04dataB\x12\n\x10one_of_thumbnail\ - \"\xf4\x01\n\x10CreateViewParams\x12\x20\n\x0cbelong_to_id\x18\x01\x20\ - \x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\ - \x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12\x1c\n\tthumbnail\x18\x04\ - \x20\x01(\tR\tthumbnail\x12*\n\tdata_type\x18\x05\x20\x01(\x0e2\r.ViewDa\ - taTypeR\x08dataType\x12\x17\n\x07view_id\x18\x06\x20\x01(\tR\x06viewId\ - \x12\x12\n\x04data\x18\x07\x20\x01(\x0cR\x04data\x12\x1f\n\x0bplugin_typ\ - e\x18\x08\x20\x01(\x05R\npluginType\"\x1e\n\x06ViewId\x12\x14\n\x05value\ - \x18\x01\x20\x01(\tR\x05value\"&\n\x0eRepeatedViewId\x12\x14\n\x05items\ - \x18\x01\x20\x03(\tR\x05items\"\xaa\x01\n\x11UpdateViewPayload\x12\x17\n\ - \x07view_id\x18\x01\x20\x01(\tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\ - \x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\ - \x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of\ - _nameB\r\n\x0bone_of_descB\x12\n\x10one_of_thumbnail\"\xa9\x01\n\x10Upda\ - teViewParams\x12\x17\n\x07view_id\x18\x01\x20\x01(\tR\x06viewId\x12\x14\ - \n\x04name\x18\x02\x20\x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\x03\x20\ - \x01(\tH\x01R\x04desc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\x02R\tthu\ - mbnailB\r\n\x0bone_of_nameB\r\n\x0bone_of_descB\x12\n\x10one_of_thumbnai\ - l\"y\n\x15MoveFolderItemPayload\x12\x17\n\x07item_id\x18\x01\x20\x01(\tR\ - \x06itemId\x12\x12\n\x04from\x18\x02\x20\x01(\x05R\x04from\x12\x0e\n\x02\ - to\x18\x03\x20\x01(\x05R\x02to\x12#\n\x02ty\x18\x04\x20\x01(\x0e2\x13.Mo\ - veFolderItemTypeR\x02ty*'\n\x0cViewDataType\x12\r\n\tTextBlock\x10\0\x12\ - \x08\n\x04Grid\x10\x01*/\n\x12MoveFolderItemType\x12\x0b\n\x07MoveApp\ - \x10\0\x12\x0c\n\x08MoveView\x10\x01b\x06proto3\ + \n\x04name\x18\x03\x20\x01(\tR\x04name\x12*\n\tdata_type\x18\x04\x20\x01\ + (\x0e2\r.ViewDataTypeR\x08dataType\x12#\n\rmodified_time\x18\x05\x20\x01\ + (\x03R\x0cmodifiedTime\x12\x1f\n\x0bcreate_time\x18\x06\x20\x01(\x03R\nc\ + reateTime\x12\x1f\n\x0bplugin_type\x18\x07\x20\x01(\x05R\npluginType\"\ + \xe8\x01\n\x08ViewInfo\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x20\ + \n\x0cbelong_to_id\x18\x02\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\ + \x03\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x04\x20\x01(\tR\x04desc\ + \x12*\n\tdata_type\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08dataType\x12\ + -\n\nbelongings\x18\x06\x20\x01(\x0b2\r.RepeatedViewR\nbelongings\x12'\n\ + \x08ext_data\x18\x07\x20\x01(\x0b2\x0c.ViewExtDataR\x07extData\"s\n\x0bV\ + iewExtData\x12#\n\x06filter\x18\x01\x20\x01(\x0b2\x0b.ViewFilterR\x06fil\ + ter\x12\x20\n\x05group\x18\x02\x20\x01(\x0b2\n.ViewGroupR\x05group\x12\ + \x1d\n\x04sort\x18\x03\x20\x01(\x0b2\t.ViewSortR\x04sort\"'\n\nViewFilte\ + r\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\"}\n\tViewGroup\ + \x12$\n\x0egroup_field_id\x18\x01\x20\x01(\tR\x0cgroupFieldId\x12-\n\x12\ + sub_group_field_id\x18\x02\x20\x01(\tH\0R\x0fsubGroupFieldIdB\x1b\n\x19o\ + ne_of_sub_group_field_id\"%\n\x08ViewSort\x12\x19\n\x08field_id\x18\x01\ + \x20\x01(\tR\x07fieldId\"+\n\x0cRepeatedView\x12\x1b\n\x05items\x18\x01\ + \x20\x03(\x0b2\x05.ViewR\x05items\"\xf2\x01\n\x11CreateViewPayload\x12\ + \x20\n\x0cbelong_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\ + \x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04de\ + sc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\0R\tthumbnail\x12*\n\tdata_t\ + ype\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08dataType\x12\x1f\n\x0bplugi\ + n_type\x18\x06\x20\x01(\x05R\npluginType\x12\x12\n\x04data\x18\x07\x20\ + \x01(\x0cR\x04dataB\x12\n\x10one_of_thumbnail\"\xf4\x01\n\x10CreateViewP\ + arams\x12\x20\n\x0cbelong_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\ + \n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01\ + (\tR\x04desc\x12\x1c\n\tthumbnail\x18\x04\x20\x01(\tR\tthumbnail\x12*\n\ + \tdata_type\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08dataType\x12\x17\n\ + \x07view_id\x18\x06\x20\x01(\tR\x06viewId\x12\x12\n\x04data\x18\x07\x20\ + \x01(\x0cR\x04data\x12\x1f\n\x0bplugin_type\x18\x08\x20\x01(\x05R\nplugi\ + nType\"\x1e\n\x06ViewId\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value\ + \"&\n\x0eRepeatedViewId\x12\x14\n\x05items\x18\x01\x20\x03(\tR\x05items\ + \"\xaa\x01\n\x11UpdateViewPayload\x12\x17\n\x07view_id\x18\x01\x20\x01(\ + \tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\x01(\tH\0R\x04name\x12\x14\n\ + \x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12\x1e\n\tthumbnail\x18\x04\ + \x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of_nameB\r\n\x0bone_of_descB\ + \x12\n\x10one_of_thumbnail\"\xa9\x01\n\x10UpdateViewParams\x12\x17\n\x07\ + view_id\x18\x01\x20\x01(\tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\x01(\ + \tH\0R\x04name\x12\x14\n\x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12\ + \x1e\n\tthumbnail\x18\x04\x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of_nam\ + eB\r\n\x0bone_of_descB\x12\n\x10one_of_thumbnail\"y\n\x15MoveFolderItemP\ + ayload\x12\x17\n\x07item_id\x18\x01\x20\x01(\tR\x06itemId\x12\x12\n\x04f\ + rom\x18\x02\x20\x01(\x05R\x04from\x12\x0e\n\x02to\x18\x03\x20\x01(\x05R\ + \x02to\x12#\n\x02ty\x18\x04\x20\x01(\x0e2\x13.MoveFolderItemTypeR\x02ty*\ + '\n\x0cViewDataType\x12\r\n\tTextBlock\x10\0\x12\x08\n\x04Grid\x10\x01*/\ + \n\x12MoveFolderItemType\x12\x0b\n\x07MoveApp\x10\0\x12\x0c\n\x08MoveVie\ + w\x10\x01b\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto index 8b77c323b1..6009fb407c 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto +++ b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto @@ -1,18 +1,37 @@ syntax = "proto3"; message View { + string id = 1; + string belong_to_id = 2; + string name = 3; + ViewDataType data_type = 4; + int64 modified_time = 5; + int64 create_time = 6; + int32 plugin_type = 7; +} +message ViewInfo { string id = 1; string belong_to_id = 2; string name = 3; string desc = 4; ViewDataType data_type = 5; - int64 version = 6; - RepeatedView belongings = 7; - int64 modified_time = 8; - int64 create_time = 9; - string ext_data = 10; - string thumbnail = 11; - int32 plugin_type = 12; + RepeatedView belongings = 6; + ViewExtData ext_data = 7; +} +message ViewExtData { + ViewFilter filter = 1; + ViewGroup group = 2; + ViewSort sort = 3; +} +message ViewFilter { + string field_id = 1; +} +message ViewGroup { + string group_field_id = 1; + oneof one_of_sub_group_field_id { string sub_group_field_id = 2; }; +} +message ViewSort { + string field_id = 1; } message RepeatedView { repeated View items = 1; diff --git a/shared-lib/flowy-folder-data-model/src/revision/app.rs b/shared-lib/flowy-folder-data-model/src/revision/app.rs index 3ed12ca933..82b9af3812 100644 --- a/shared-lib/flowy-folder-data-model/src/revision/app.rs +++ b/shared-lib/flowy-folder-data-model/src/revision/app.rs @@ -1,9 +1,9 @@ use crate::entities::app::App; -use crate::entities::RepeatedApp; -use crate::revision::ViewRevision; +use crate::entities::{RepeatedApp, TrashType}; +use crate::revision::{TrashRevision, ViewRevision}; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[derive(Default, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct AppRevision { pub id: String, @@ -37,17 +37,14 @@ impl std::convert::From for App { } } -impl std::convert::From for AppRevision { - fn from(app: App) -> Self { - AppRevision { - id: app.id, - workspace_id: app.workspace_id, - name: app.name, - desc: app.desc, - belongings: app.belongings.into(), - version: app.version, - modified_time: app.modified_time, - create_time: app.create_time, +impl std::convert::From for TrashRevision { + fn from(app_rev: AppRevision) -> Self { + TrashRevision { + id: app_rev.id, + name: app_rev.name, + modified_time: app_rev.modified_time, + create_time: app_rev.create_time, + ty: TrashType::TrashApp, } } } @@ -58,13 +55,3 @@ impl std::convert::From> for RepeatedApp { RepeatedApp { items } } } - -impl std::convert::From for Vec { - fn from(repeated_app: RepeatedApp) -> Self { - repeated_app - .items - .into_iter() - .map(|value| value.into()) - .collect::>() - } -} diff --git a/shared-lib/flowy-folder-data-model/src/revision/trash.rs b/shared-lib/flowy-folder-data-model/src/revision/trash.rs index f4a4d3a932..08f3bb27a1 100644 --- a/shared-lib/flowy-folder-data-model/src/revision/trash.rs +++ b/shared-lib/flowy-folder-data-model/src/revision/trash.rs @@ -1,7 +1,8 @@ use crate::entities::trash::{Trash, TrashType}; +use crate::entities::{RepeatedTrash, TrashId}; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[derive(Default, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct TrashRevision { pub id: String, @@ -14,14 +15,21 @@ pub struct TrashRevision { pub ty: TrashType, } +impl std::convert::From> for RepeatedTrash { + fn from(trash_revs: Vec) -> Self { + let items: Vec = trash_revs.into_iter().map(|trash_rev| trash_rev.into()).collect(); + RepeatedTrash { items } + } +} + impl std::convert::From for Trash { - fn from(trash_serde: TrashRevision) -> Self { + fn from(trash_rev: TrashRevision) -> Self { Trash { - id: trash_serde.id, - name: trash_serde.name, - modified_time: trash_serde.modified_time, - create_time: trash_serde.create_time, - ty: trash_serde.ty, + id: trash_rev.id, + name: trash_rev.name, + modified_time: trash_rev.modified_time, + create_time: trash_rev.create_time, + ty: trash_rev.ty, } } } @@ -37,3 +45,12 @@ impl std::convert::From for TrashRevision { } } } + +impl std::convert::From<&TrashRevision> for TrashId { + fn from(trash: &TrashRevision) -> Self { + TrashId { + id: trash.id.clone(), + ty: trash.ty.clone(), + } + } +} diff --git a/shared-lib/flowy-folder-data-model/src/revision/view.rs b/shared-lib/flowy-folder-data-model/src/revision/view.rs index 313ecf3013..e58ee95928 100644 --- a/shared-lib/flowy-folder-data-model/src/revision/view.rs +++ b/shared-lib/flowy-folder-data-model/src/revision/view.rs @@ -1,8 +1,9 @@ use crate::entities::view::{View, ViewDataType}; -use crate::entities::RepeatedView; +use crate::entities::{RepeatedView, TrashType, ViewExtData, ViewFilter, ViewGroup, ViewSort}; +use crate::revision::TrashRevision; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[derive(Default, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct ViewRevision { pub id: String, @@ -43,51 +44,95 @@ impl std::convert::From for View { id: view_serde.id, belong_to_id: view_serde.belong_to_id, name: view_serde.name, - desc: view_serde.desc, data_type: view_serde.data_type, - version: view_serde.version, - belongings: view_serde.belongings.into(), modified_time: view_serde.modified_time, create_time: view_serde.create_time, - ext_data: view_serde.ext_data, - thumbnail: view_serde.thumbnail, plugin_type: view_serde.plugin_type, } } } -impl std::convert::From for ViewRevision { - fn from(view: View) -> Self { - ViewRevision { - id: view.id, - belong_to_id: view.belong_to_id, - name: view.name, - desc: view.desc, - data_type: view.data_type, - version: view.version, - belongings: view.belongings.into(), - modified_time: view.modified_time, - create_time: view.create_time, - ext_data: view.ext_data, - thumbnail: view.thumbnail, - plugin_type: view.plugin_type, +impl std::convert::From for TrashRevision { + fn from(view_rev: ViewRevision) -> Self { + TrashRevision { + id: view_rev.id, + name: view_rev.name, + modified_time: view_rev.modified_time, + create_time: view_rev.create_time, + ty: TrashType::TrashView, } } } +#[derive(Serialize, Deserialize)] +pub struct ViewExtDataRevision { + pub filter: ViewFilterRevision, + pub group: ViewGroupRevision, + pub sort: ViewSortRevision, +} + +#[derive(Serialize, Deserialize)] +pub struct ViewFilterRevision { + pub field_id: String, +} + +#[derive(Serialize, Deserialize)] +pub struct ViewGroupRevision { + pub group_field_id: String, + pub sub_group_field_id: Option, +} + +#[derive(Serialize, Deserialize)] +pub struct ViewSortRevision { + field_id: String, +} + +impl std::convert::From for ViewExtData { + fn from(s: String) -> Self { + match serde_json::from_str::(&s) { + Ok(data) => data.into(), + Err(err) => { + log::error!("{:?}", err); + ViewExtData::default() + } + } + } +} + +impl std::convert::From for ViewExtData { + fn from(rev: ViewExtDataRevision) -> Self { + ViewExtData { + filter: rev.filter.into(), + group: rev.group.into(), + sort: rev.sort.into(), + } + } +} + +impl std::convert::From for ViewFilter { + fn from(rev: ViewFilterRevision) -> Self { + ViewFilter { field_id: rev.field_id } + } +} + +impl std::convert::From for ViewGroup { + fn from(rev: ViewGroupRevision) -> Self { + ViewGroup { + group_field_id: rev.group_field_id, + sub_group_field_id: rev.sub_group_field_id, + } + } +} + +impl std::convert::From for ViewSort { + fn from(rev: ViewSortRevision) -> Self { + ViewSort { field_id: rev.field_id } + } +} + impl std::convert::From> for RepeatedView { fn from(values: Vec) -> Self { let items = values.into_iter().map(|value| value.into()).collect::>(); RepeatedView { items } } } - -impl std::convert::From for Vec { - fn from(repeated_view: RepeatedView) -> Self { - repeated_view - .items - .into_iter() - .map(|value| value.into()) - .collect::>() - } -} diff --git a/shared-lib/flowy-folder-data-model/src/revision/workspace.rs b/shared-lib/flowy-folder-data-model/src/revision/workspace.rs index fb4fb974f6..5070041211 100644 --- a/shared-lib/flowy-folder-data-model/src/revision/workspace.rs +++ b/shared-lib/flowy-folder-data-model/src/revision/workspace.rs @@ -2,7 +2,7 @@ use crate::entities::workspace::Workspace; use crate::revision::AppRevision; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[derive(Default, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct WorkspaceRevision { pub id: String, @@ -29,16 +29,3 @@ impl std::convert::From for Workspace { } } } - -impl std::convert::From for WorkspaceRevision { - fn from(workspace: Workspace) -> Self { - WorkspaceRevision { - id: workspace.id, - name: workspace.name, - desc: workspace.desc, - apps: workspace.apps.into(), - modified_time: workspace.modified_time, - create_time: workspace.create_time, - } - } -} diff --git a/shared-lib/flowy-folder-data-model/src/user_default.rs b/shared-lib/flowy-folder-data-model/src/user_default.rs index ed56d2d80a..7e8023067c 100644 --- a/shared-lib/flowy-folder-data-model/src/user_default.rs +++ b/shared-lib/flowy-folder-data-model/src/user_default.rs @@ -1,24 +1,19 @@ use crate::entities::app::gen_app_id; use crate::entities::view::gen_view_id; +use crate::entities::view::ViewDataType; use crate::entities::workspace::gen_workspace_id; -use crate::entities::{ - app::{App, RepeatedApp}, - view::{RepeatedView, View, ViewDataType}, - workspace::Workspace, -}; +use crate::revision::{AppRevision, ViewRevision, WorkspaceRevision}; use chrono::Utc; -pub fn create_default_workspace() -> Workspace { +pub fn create_default_workspace() -> WorkspaceRevision { let time = Utc::now(); let workspace_id = gen_workspace_id(); let name = "Workspace".to_string(); let desc = "".to_string(); - let apps = RepeatedApp { - items: vec![create_default_app(workspace_id.to_string(), time)], - }; + let apps = vec![create_default_app(workspace_id.to_string(), time)]; - Workspace { + WorkspaceRevision { id: workspace_id, name, desc, @@ -28,16 +23,14 @@ pub fn create_default_workspace() -> Workspace { } } -fn create_default_app(workspace_id: String, time: chrono::DateTime) -> App { +fn create_default_app(workspace_id: String, time: chrono::DateTime) -> AppRevision { let app_id = gen_app_id(); let name = "⭐️ Getting started".to_string(); let desc = "".to_string(); - let views = RepeatedView { - items: vec![create_default_view(app_id.to_string(), time)], - }; + let views = vec![create_default_view(app_id.to_string(), time)]; - App { + AppRevision { id: app_id, workspace_id, name, @@ -49,20 +42,19 @@ fn create_default_app(workspace_id: String, time: chrono::DateTime) -> App } } -fn create_default_view(app_id: String, time: chrono::DateTime) -> View { +fn create_default_view(app_id: String, time: chrono::DateTime) -> ViewRevision { let view_id = gen_view_id(); let name = "Read me".to_string(); - let desc = "".to_string(); let data_type = ViewDataType::TextBlock; - View { + ViewRevision { id: view_id, belong_to_id: app_id, name, - desc, + desc: "".to_string(), data_type, version: 0, - belongings: Default::default(), + belongings: vec![], modified_time: time.timestamp(), create_time: time.timestamp(), ext_data: "".to_string(), diff --git a/shared-lib/flowy-sync/src/client_folder/builder.rs b/shared-lib/flowy-sync/src/client_folder/builder.rs index 8dd82481a2..73d9aac24f 100644 --- a/shared-lib/flowy-sync/src/client_folder/builder.rs +++ b/shared-lib/flowy-sync/src/client_folder/builder.rs @@ -6,7 +6,6 @@ use crate::{ errors::{CollaborateError, CollaborateResult}, }; -use flowy_folder_data_model::entities::{Trash, Workspace}; use flowy_folder_data_model::revision::{TrashRevision, WorkspaceRevision}; use lib_ot::core::{PlainTextAttributes, PlainTextDelta, PlainTextDeltaBuilder}; use serde::{Deserialize, Serialize}; @@ -26,16 +25,13 @@ impl FolderPadBuilder { } } - pub(crate) fn with_workspace(mut self, workspaces: Vec) -> Self { - self.workspaces = workspaces - .into_iter() - .map(|workspace| Arc::new(workspace.into())) - .collect::>(); + pub(crate) fn with_workspace(mut self, workspaces: Vec) -> Self { + self.workspaces = workspaces.into_iter().map(Arc::new).collect(); self } - pub(crate) fn with_trash(mut self, trash: Vec) -> Self { - self.trash = trash.into_iter().map(|t| Arc::new(t.into())).collect::>(); + pub(crate) fn with_trash(mut self, trash: Vec) -> Self { + self.trash = trash.into_iter().map(Arc::new).collect::>(); self } diff --git a/shared-lib/flowy-sync/src/client_folder/folder_pad.rs b/shared-lib/flowy-sync/src/client_folder/folder_pad.rs index 4fbbfed723..ac5758e64c 100644 --- a/shared-lib/flowy-sync/src/client_folder/folder_pad.rs +++ b/shared-lib/flowy-sync/src/client_folder/folder_pad.rs @@ -8,7 +8,7 @@ use crate::{ }, errors::{CollaborateError, CollaborateResult}, }; -use flowy_folder_data_model::entities::{App, Trash, View, Workspace}; + use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use lib_infra::util::move_vec_element; use lib_ot::core::*; @@ -24,7 +24,7 @@ pub struct FolderPad { } impl FolderPad { - pub fn new(workspaces: Vec, trash: Vec) -> CollaborateResult { + pub fn new(workspaces: Vec, trash: Vec) -> CollaborateResult { FolderPadBuilder::new() .with_workspace(workspaces) .with_trash(trash) @@ -61,9 +61,9 @@ impl FolderPad { self.workspaces.is_empty() && self.trash.is_empty() } - #[tracing::instrument(level = "trace", skip(self, workspace), fields(workspace_name=%workspace.name), err)] - pub fn create_workspace(&mut self, workspace: Workspace) -> CollaborateResult> { - let workspace = Arc::new(workspace.into()); + #[tracing::instrument(level = "trace", skip(self, workspace_rev), fields(workspace_name=%workspace_rev.name), err)] + pub fn create_workspace(&mut self, workspace_rev: WorkspaceRevision) -> CollaborateResult> { + let workspace = Arc::new(workspace_rev); if self.workspaces.contains(&workspace) { tracing::warn!("[RootFolder]: Duplicate workspace"); return Ok(None); @@ -93,19 +93,19 @@ impl FolderPad { }) } - pub fn read_workspaces(&self, workspace_id: Option) -> CollaborateResult> { + pub fn read_workspaces(&self, workspace_id: Option) -> CollaborateResult> { match workspace_id { None => { let workspaces = self .workspaces .iter() - .map(|workspace| workspace.as_ref().clone().into()) - .collect::>(); + .map(|workspace| workspace.as_ref().clone()) + .collect::>(); Ok(workspaces) } Some(workspace_id) => { if let Some(workspace) = self.workspaces.iter().find(|workspace| workspace.id == workspace_id) { - Ok(vec![workspace.as_ref().clone().into()]) + Ok(vec![workspace.as_ref().clone()]) } else { Err(CollaborateError::record_not_found() .context(format!("Can't find workspace with id {}", workspace_id))) @@ -122,24 +122,23 @@ impl FolderPad { }) } - #[tracing::instrument(level = "trace", skip(self), fields(app_name=%app.name), err)] - pub fn create_app(&mut self, app: App) -> CollaborateResult> { - let workspace_id = app.workspace_id.clone(); - let app_serde: AppRevision = app.into(); + #[tracing::instrument(level = "trace", skip(self), fields(app_name=%app_rev.name), err)] + pub fn create_app(&mut self, app_rev: AppRevision) -> CollaborateResult> { + let workspace_id = app_rev.workspace_id.clone(); self.with_workspace(&workspace_id, move |workspace| { - if workspace.apps.contains(&app_serde) { + if workspace.apps.contains(&app_rev) { tracing::warn!("[RootFolder]: Duplicate app"); return Ok(None); } - workspace.apps.push(app_serde); + workspace.apps.push(app_rev); Ok(Some(())) }) } - pub fn read_app(&self, app_id: &str) -> CollaborateResult { + pub fn read_app(&self, app_id: &str) -> CollaborateResult { for workspace in &self.workspaces { if let Some(app) = workspace.apps.iter().find(|app| app.id == app_id) { - return Ok(app.clone().into()); + return Ok(app.clone()); } } Err(CollaborateError::record_not_found().context(format!("Can't find app with id {}", app_id))) @@ -183,36 +182,35 @@ impl FolderPad { }) } - #[tracing::instrument(level = "trace", skip(self), fields(view_name=%view.name), err)] - pub fn create_view(&mut self, view: View) -> CollaborateResult> { - let app_id = view.belong_to_id.clone(); - let view_serde: ViewRevision = view.into(); + #[tracing::instrument(level = "trace", skip(self), fields(view_name=%view_rev.name), err)] + pub fn create_view(&mut self, view_rev: ViewRevision) -> CollaborateResult> { + let app_id = view_rev.belong_to_id.clone(); self.with_app(&app_id, move |app| { - if app.belongings.contains(&view_serde) { + if app.belongings.contains(&view_rev) { tracing::warn!("[RootFolder]: Duplicate view"); return Ok(None); } - app.belongings.push(view_serde); + app.belongings.push(view_rev); Ok(Some(())) }) } - pub fn read_view(&self, view_id: &str) -> CollaborateResult { + pub fn read_view(&self, view_id: &str) -> CollaborateResult { for workspace in &self.workspaces { for app in &(*workspace.apps) { if let Some(view) = app.belongings.iter().find(|b| b.id == view_id) { - return Ok(view.clone().into()); + return Ok(view.clone()); } } } Err(CollaborateError::record_not_found().context(format!("Can't find view with id {}", view_id))) } - pub fn read_views(&self, belong_to_id: &str) -> CollaborateResult> { + pub fn read_views(&self, belong_to_id: &str) -> CollaborateResult> { for workspace in &self.workspaces { for app in &(*workspace.apps) { if app.id == belong_to_id { - return Ok(app.belongings.iter().map(|view| view.clone().into()).collect()); + return Ok(app.belongings.to_vec()); } } } @@ -261,27 +259,24 @@ impl FolderPad { }) } - pub fn create_trash(&mut self, trash: Vec) -> CollaborateResult> { + pub fn create_trash(&mut self, trash: Vec) -> CollaborateResult> { self.with_trash(|t| { - let mut new_trash = trash - .into_iter() - .map(|t| Arc::new(t.into())) - .collect::>>(); + let mut new_trash = trash.into_iter().map(Arc::new).collect::>>(); t.append(&mut new_trash); Ok(Some(())) }) } - pub fn read_trash(&self, trash_id: Option) -> CollaborateResult> { + pub fn read_trash(&self, trash_id: Option) -> CollaborateResult> { match trash_id { None => Ok(self .trash .iter() - .map(|t| t.as_ref().clone().into()) - .collect::>()), + .map(|t| t.as_ref().clone()) + .collect::>()), Some(trash_id) => match self.trash.iter().find(|t| t.id == trash_id) { - Some(trash) => Ok(vec![trash.as_ref().clone().into()]), + Some(trash) => Ok(vec![trash.as_ref().clone()]), None => Ok(vec![]), }, } @@ -438,7 +433,8 @@ mod tests { #![allow(clippy::all)] use crate::{client_folder::folder_pad::FolderPad, entities::folder_info::FolderDelta}; use chrono::Utc; - use flowy_folder_data_model::entities::{app::App, trash::Trash, view::View, workspace::Workspace}; + + use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use lib_ot::core::{OperationTransformable, PlainTextDelta, PlainTextDeltaBuilder}; #[test] @@ -446,11 +442,11 @@ mod tests { let (mut folder, initial_delta, _) = test_folder(); let _time = Utc::now(); - let mut workspace_1 = Workspace::default(); + let mut workspace_1 = WorkspaceRevision::default(); workspace_1.name = "My first workspace".to_owned(); let delta_1 = folder.create_workspace(workspace_1).unwrap().unwrap().delta; - let mut workspace_2 = Workspace::default(); + let mut workspace_2 = WorkspaceRevision::default(); workspace_2.name = "My second workspace".to_owned(); let delta_2 = folder.create_workspace(workspace_2).unwrap().unwrap().delta; @@ -751,62 +747,68 @@ mod tests { ); } - fn test_folder() -> (FolderPad, FolderDelta, Workspace) { + fn test_folder() -> (FolderPad, FolderDelta, WorkspaceRevision) { let mut folder = FolderPad::default(); let folder_json = serde_json::to_string(&folder).unwrap(); let mut delta = PlainTextDeltaBuilder::new().insert(&folder_json).build(); - let mut workspace = Workspace::default(); - workspace.name = "😁 my first workspace".to_owned(); - workspace.id = "1".to_owned(); + let mut workspace_rev = WorkspaceRevision::default(); + workspace_rev.name = "😁 my first workspace".to_owned(); + workspace_rev.id = "1".to_owned(); delta = delta - .compose(&folder.create_workspace(workspace.clone()).unwrap().unwrap().delta) + .compose(&folder.create_workspace(workspace_rev.clone()).unwrap().unwrap().delta) .unwrap(); - (folder, delta, workspace) + (folder, delta, workspace_rev) } - fn test_app_folder() -> (FolderPad, FolderDelta, App) { + fn test_app_folder() -> (FolderPad, FolderDelta, AppRevision) { let (mut folder, mut initial_delta, workspace) = test_folder(); - let mut app = App::default(); - app.workspace_id = workspace.id; - app.name = "😁 my first app".to_owned(); + let mut app_rev = AppRevision::default(); + app_rev.workspace_id = workspace.id; + app_rev.name = "😁 my first app".to_owned(); initial_delta = initial_delta - .compose(&folder.create_app(app.clone()).unwrap().unwrap().delta) + .compose(&folder.create_app(app_rev.clone()).unwrap().unwrap().delta) .unwrap(); - (folder, initial_delta, app) + (folder, initial_delta, app_rev) } - fn test_view_folder() -> (FolderPad, FolderDelta, View) { + fn test_view_folder() -> (FolderPad, FolderDelta, ViewRevision) { let (mut folder, mut initial_delta, app) = test_app_folder(); - let mut view = View::default(); - view.belong_to_id = app.id.clone(); - view.name = "🎃 my first view".to_owned(); + let mut view_rev = ViewRevision::default(); + view_rev.belong_to_id = app.id.clone(); + view_rev.name = "🎃 my first view".to_owned(); initial_delta = initial_delta - .compose(&folder.create_view(view.clone()).unwrap().unwrap().delta) + .compose(&folder.create_view(view_rev.clone()).unwrap().unwrap().delta) .unwrap(); - (folder, initial_delta, view) + (folder, initial_delta, view_rev) } - fn test_trash() -> (FolderPad, FolderDelta, Trash) { + fn test_trash() -> (FolderPad, FolderDelta, TrashRevision) { let mut folder = FolderPad::default(); let folder_json = serde_json::to_string(&folder).unwrap(); let mut delta = PlainTextDeltaBuilder::new().insert(&folder_json).build(); - let mut trash = Trash::default(); - trash.name = "🚽 my first trash".to_owned(); - trash.id = "1".to_owned(); + let mut trash_rev = TrashRevision::default(); + trash_rev.name = "🚽 my first trash".to_owned(); + trash_rev.id = "1".to_owned(); delta = delta - .compose(&folder.create_trash(vec![trash.clone()]).unwrap().unwrap().delta) + .compose( + &folder + .create_trash(vec![trash_rev.clone().into()]) + .unwrap() + .unwrap() + .delta, + ) .unwrap(); - (folder, delta, trash) + (folder, delta, trash_rev) } fn make_folder_from_delta(mut initial_delta: FolderDelta, deltas: Vec) -> FolderPad { diff --git a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs b/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs index d0c2853fe6..da80dfebd0 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs @@ -25,7 +25,7 @@ pub trait JsonDeserializer { impl GridMetaPad { pub async fn duplicate_grid_meta(&self) -> (Vec, Vec) { - let fields = self.grid_meta.fields.iter().cloned().collect::>(); + let fields = self.grid_meta.fields.to_vec(); let blocks = self .grid_meta From ae4cc496fc86ea4531bd069f1b3b887b48a19582 Mon Sep 17 00:00:00 2001 From: appflowy Date: Tue, 14 Jun 2022 08:37:44 +0800 Subject: [PATCH 06/11] chore: add read view info event --- .../plugins/board/src/board_page.dart | 2 + .../dart_event/flowy-folder/dart_event.dart | 51 ++++++---- .../flowy-folder/event_map.pbenum.dart | 12 ++- .../flowy-folder/event_map.pbjson.dart | 11 ++- frontend/rust-lib/Cargo.lock | 97 ++++++++++++++++--- .../rust-lib/flowy-folder/src/event_map.rs | 16 +-- .../src/protobuf/model/event_map.rs | 35 ++++--- .../src/protobuf/proto/event_map.proto | 9 +- .../src/services/persistence/mod.rs | 1 - .../services/persistence/version_1/v1_impl.rs | 1 + .../services/persistence/version_2/v2_impl.rs | 1 - .../src/services/view/controller.rs | 31 ++++++ .../src/services/view/event_handler.rs | 11 +-- frontend/rust-lib/flowy-grid/Cargo.toml | 2 +- frontend/rust-lib/flowy-net/Cargo.toml | 2 +- frontend/rust-lib/flowy-revision/Cargo.toml | 2 +- frontend/rust-lib/flowy-text-block/Cargo.toml | 2 +- frontend/rust-lib/lib-dispatch/Cargo.toml | 2 +- shared-lib/Cargo.lock | 89 ++++++++++++++--- shared-lib/flowy-derive/Cargo.toml | 2 +- shared-lib/flowy-sync/Cargo.toml | 2 +- shared-lib/lib-ot/Cargo.toml | 2 +- shared-lib/lib-ws/Cargo.toml | 2 +- 23 files changed, 289 insertions(+), 96 deletions(-) diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart index 6ef88d7fe6..5a74ddd4f4 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/board/src/board_page.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unused_field + import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart index 21dbe0ed20..064fae1fa4 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart @@ -253,6 +253,40 @@ class FolderEventDuplicateView { } } +class FolderEventCloseView { + ViewId request; + FolderEventCloseView(this.request); + + Future> send() { + final request = FFIRequest.create() + ..event = FolderEvent.CloseView.toString() + ..payload = requestToBytes(this.request); + + return Dispatch.asyncRequest(request) + .then((bytesResult) => bytesResult.fold( + (bytes) => left(unit), + (errBytes) => right(FlowyError.fromBuffer(errBytes)), + )); + } +} + +class FolderEventReadViewInfo { + ViewId request; + FolderEventReadViewInfo(this.request); + + Future> send() { + final request = FFIRequest.create() + ..event = FolderEvent.ReadViewInfo.toString() + ..payload = requestToBytes(this.request); + + return Dispatch.asyncRequest(request) + .then((bytesResult) => bytesResult.fold( + (okBytes) => left(ViewInfo.fromBuffer(okBytes)), + (errBytes) => right(FlowyError.fromBuffer(errBytes)), + )); + } +} + class FolderEventCopyLink { FolderEventCopyLink(); @@ -284,23 +318,6 @@ class FolderEventSetLatestView { } } -class FolderEventCloseView { - ViewId request; - FolderEventCloseView(this.request); - - Future> send() { - final request = FFIRequest.create() - ..event = FolderEvent.CloseView.toString() - ..payload = requestToBytes(this.request); - - return Dispatch.asyncRequest(request) - .then((bytesResult) => bytesResult.fold( - (bytes) => left(unit), - (errBytes) => right(FlowyError.fromBuffer(errBytes)), - )); - } -} - class FolderEventMoveFolderItem { MoveFolderItemPayload request; FolderEventMoveFolderItem(this.request); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart index 9af4068b89..6df14e0a40 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart @@ -25,10 +25,11 @@ class FolderEvent extends $pb.ProtobufEnum { static const FolderEvent UpdateView = FolderEvent._(203, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateView'); static const FolderEvent DeleteView = FolderEvent._(204, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteView'); static const FolderEvent DuplicateView = FolderEvent._(205, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DuplicateView'); - static const FolderEvent CopyLink = FolderEvent._(206, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CopyLink'); - static const FolderEvent SetLatestView = FolderEvent._(207, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SetLatestView'); - static const FolderEvent CloseView = FolderEvent._(208, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CloseView'); - static const FolderEvent MoveFolderItem = FolderEvent._(209, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MoveFolderItem'); + static const FolderEvent CloseView = FolderEvent._(206, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CloseView'); + static const FolderEvent ReadViewInfo = FolderEvent._(207, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ReadViewInfo'); + static const FolderEvent CopyLink = FolderEvent._(220, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CopyLink'); + static const FolderEvent SetLatestView = FolderEvent._(221, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SetLatestView'); + static const FolderEvent MoveFolderItem = FolderEvent._(230, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MoveFolderItem'); static const FolderEvent ReadTrash = FolderEvent._(300, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ReadTrash'); static const FolderEvent PutbackTrash = FolderEvent._(301, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PutbackTrash'); static const FolderEvent DeleteTrash = FolderEvent._(302, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteTrash'); @@ -51,9 +52,10 @@ class FolderEvent extends $pb.ProtobufEnum { UpdateView, DeleteView, DuplicateView, + CloseView, + ReadViewInfo, CopyLink, SetLatestView, - CloseView, MoveFolderItem, ReadTrash, PutbackTrash, diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart index 9f5d05b81c..ca9f0650fe 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart @@ -27,10 +27,11 @@ const FolderEvent$json = const { const {'1': 'UpdateView', '2': 203}, const {'1': 'DeleteView', '2': 204}, const {'1': 'DuplicateView', '2': 205}, - const {'1': 'CopyLink', '2': 206}, - const {'1': 'SetLatestView', '2': 207}, - const {'1': 'CloseView', '2': 208}, - const {'1': 'MoveFolderItem', '2': 209}, + const {'1': 'CloseView', '2': 206}, + const {'1': 'ReadViewInfo', '2': 207}, + const {'1': 'CopyLink', '2': 220}, + const {'1': 'SetLatestView', '2': 221}, + const {'1': 'MoveFolderItem', '2': 230}, const {'1': 'ReadTrash', '2': 300}, const {'1': 'PutbackTrash', '2': 301}, const {'1': 'DeleteTrash', '2': 302}, @@ -40,4 +41,4 @@ const FolderEvent$json = const { }; /// Descriptor for `FolderEvent`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARINCghDb3B5TGluaxDOARISCg1TZXRMYXRlc3RWaWV3EM8BEg4KCUNsb3NlVmlldxDQARITCg5Nb3ZlRm9sZGVySXRlbRDRARIOCglSZWFkVHJhc2gQrAISEQoMUHV0YmFja1RyYXNoEK0CEhAKC0RlbGV0ZVRyYXNoEK4CEhQKD1Jlc3RvcmVBbGxUcmFzaBCvAhITCg5EZWxldGVBbGxUcmFzaBCwAg=='); +final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARIOCglDbG9zZVZpZXcQzgESEQoMUmVhZFZpZXdJbmZvEM8BEg0KCENvcHlMaW5rENwBEhIKDVNldExhdGVzdFZpZXcQ3QESEwoOTW92ZUZvbGRlckl0ZW0Q5gESDgoJUmVhZFRyYXNoEKwCEhEKDFB1dGJhY2tUcmFzaBCtAhIQCgtEZWxldGVUcmFzaBCuAhIUCg9SZXN0b3JlQWxsVHJhc2gQrwISEwoORGVsZXRlQWxsVHJhc2gQsAI='); diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index 57cfede8cb..1b3e960e05 100755 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -591,12 +591,13 @@ dependencies = [ [[package]] name = "dashmap" -version = "4.0.2" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" dependencies = [ "cfg-if", "num_cpus", + "parking_lot 0.12.1", ] [[package]] @@ -887,7 +888,7 @@ dependencies = [ "lib-infra", "lib-ot", "log", - "parking_lot", + "parking_lot 0.11.2", "pin-project", "protobuf", "serde", @@ -1002,7 +1003,7 @@ dependencies = [ "lib-ws", "log", "nanoid", - "parking_lot", + "parking_lot 0.11.2", "protobuf", "reqwest", "serde", @@ -1061,7 +1062,7 @@ dependencies = [ "lib-log", "lib-ws", "log", - "parking_lot", + "parking_lot 0.11.2", "protobuf", "serde", "tokio", @@ -1085,7 +1086,7 @@ dependencies = [ "lib-ot", "log", "md5", - "parking_lot", + "parking_lot 0.11.2", "protobuf", "serde", "serde_json", @@ -1187,7 +1188,7 @@ dependencies = [ "log", "nanoid", "once_cell", - "parking_lot", + "parking_lot 0.11.2", "protobuf", "serde", "serde_json", @@ -1806,7 +1807,7 @@ dependencies = [ "futures-util", "lib-infra", "log", - "parking_lot", + "parking_lot 0.11.2", "paste", "pin-project", "protobuf", @@ -1843,9 +1844,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" dependencies = [ "scopeguard", ] @@ -2126,7 +2127,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.5", +] + +[[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 0.9.3", ] [[package]] @@ -2143,6 +2154,19 @@ dependencies = [ "winapi", ] +[[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", +] + [[package]] name = "parse-zoneinfo" version = "0.3.0" @@ -2526,7 +2550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f" dependencies = [ "log", - "parking_lot", + "parking_lot 0.11.2", "scheduled-thread-pool", ] @@ -2804,7 +2828,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7" dependencies = [ - "parking_lot", + "parking_lot 0.11.2", ] [[package]] @@ -2947,7 +2971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d" dependencies = [ "lazy_static", - "parking_lot", + "parking_lot 0.11.2", "serial_test_derive", ] @@ -3241,7 +3265,7 @@ dependencies = [ "mio", "num_cpus", "once_cell", - "parking_lot", + "parking_lot 0.11.2", "pin-project-lite", "signal-hook-registry", "tokio-macros", @@ -3766,6 +3790,49 @@ 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", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[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_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[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_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "winreg" version = "0.7.0" diff --git a/frontend/rust-lib/flowy-folder/src/event_map.rs b/frontend/rust-lib/flowy-folder/src/event_map.rs index c9f1ebcd27..bc2afa9491 100644 --- a/frontend/rust-lib/flowy-folder/src/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/event_map.rs @@ -59,6 +59,7 @@ pub fn create(folder: Arc) -> Module { module = module .event(FolderEvent::CreateView, create_view_handler) .event(FolderEvent::ReadView, read_view_handler) + .event(FolderEvent::ReadViewInfo, read_view_info_handler) .event(FolderEvent::UpdateView, update_view_handler) .event(FolderEvent::DeleteView, delete_view_handler) .event(FolderEvent::DuplicateView, duplicate_view_handler) @@ -124,17 +125,20 @@ pub enum FolderEvent { #[event(input = "ViewId")] DuplicateView = 205, + #[event(input = "ViewId")] + CloseView = 206, + + #[event(input = "ViewId", output = "ViewInfo")] + ReadViewInfo = 207, + #[event()] - CopyLink = 206, + CopyLink = 220, #[event(input = "ViewId")] - SetLatestView = 207, - - #[event(input = "ViewId")] - CloseView = 208, + SetLatestView = 221, #[event(input = "MoveFolderItemPayload")] - MoveFolderItem = 209, + MoveFolderItem = 230, #[event(output = "RepeatedTrash")] ReadTrash = 300, diff --git a/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs b/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs index dab3bad371..6cfa810ab9 100644 --- a/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs @@ -40,10 +40,11 @@ pub enum FolderEvent { UpdateView = 203, DeleteView = 204, DuplicateView = 205, - CopyLink = 206, - SetLatestView = 207, - CloseView = 208, - MoveFolderItem = 209, + CloseView = 206, + ReadViewInfo = 207, + CopyLink = 220, + SetLatestView = 221, + MoveFolderItem = 230, ReadTrash = 300, PutbackTrash = 301, DeleteTrash = 302, @@ -73,10 +74,11 @@ impl ::protobuf::ProtobufEnum for FolderEvent { 203 => ::std::option::Option::Some(FolderEvent::UpdateView), 204 => ::std::option::Option::Some(FolderEvent::DeleteView), 205 => ::std::option::Option::Some(FolderEvent::DuplicateView), - 206 => ::std::option::Option::Some(FolderEvent::CopyLink), - 207 => ::std::option::Option::Some(FolderEvent::SetLatestView), - 208 => ::std::option::Option::Some(FolderEvent::CloseView), - 209 => ::std::option::Option::Some(FolderEvent::MoveFolderItem), + 206 => ::std::option::Option::Some(FolderEvent::CloseView), + 207 => ::std::option::Option::Some(FolderEvent::ReadViewInfo), + 220 => ::std::option::Option::Some(FolderEvent::CopyLink), + 221 => ::std::option::Option::Some(FolderEvent::SetLatestView), + 230 => ::std::option::Option::Some(FolderEvent::MoveFolderItem), 300 => ::std::option::Option::Some(FolderEvent::ReadTrash), 301 => ::std::option::Option::Some(FolderEvent::PutbackTrash), 302 => ::std::option::Option::Some(FolderEvent::DeleteTrash), @@ -103,9 +105,10 @@ impl ::protobuf::ProtobufEnum for FolderEvent { FolderEvent::UpdateView, FolderEvent::DeleteView, FolderEvent::DuplicateView, + FolderEvent::CloseView, + FolderEvent::ReadViewInfo, FolderEvent::CopyLink, FolderEvent::SetLatestView, - FolderEvent::CloseView, FolderEvent::MoveFolderItem, FolderEvent::ReadTrash, FolderEvent::PutbackTrash, @@ -140,19 +143,19 @@ impl ::protobuf::reflect::ProtobufValue for FolderEvent { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0fevent_map.proto*\xc3\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\ + \n\x0fevent_map.proto*\xd6\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\ pace\x10\0\x12\x14\n\x10ReadCurWorkspace\x10\x01\x12\x12\n\x0eReadWorksp\ aces\x10\x02\x12\x13\n\x0fDeleteWorkspace\x10\x03\x12\x11\n\rOpenWorkspa\ ce\x10\x04\x12\x15\n\x11ReadWorkspaceApps\x10\x05\x12\r\n\tCreateApp\x10\ e\x12\r\n\tDeleteApp\x10f\x12\x0b\n\x07ReadApp\x10g\x12\r\n\tUpdateApp\ \x10h\x12\x0f\n\nCreateView\x10\xc9\x01\x12\r\n\x08ReadView\x10\xca\x01\ \x12\x0f\n\nUpdateView\x10\xcb\x01\x12\x0f\n\nDeleteView\x10\xcc\x01\x12\ - \x12\n\rDuplicateView\x10\xcd\x01\x12\r\n\x08CopyLink\x10\xce\x01\x12\ - \x12\n\rSetLatestView\x10\xcf\x01\x12\x0e\n\tCloseView\x10\xd0\x01\x12\ - \x13\n\x0eMoveFolderItem\x10\xd1\x01\x12\x0e\n\tReadTrash\x10\xac\x02\ - \x12\x11\n\x0cPutbackTrash\x10\xad\x02\x12\x10\n\x0bDeleteTrash\x10\xae\ - \x02\x12\x14\n\x0fRestoreAllTrash\x10\xaf\x02\x12\x13\n\x0eDeleteAllTras\ - h\x10\xb0\x02b\x06proto3\ + \x12\n\rDuplicateView\x10\xcd\x01\x12\x0e\n\tCloseView\x10\xce\x01\x12\ + \x11\n\x0cReadViewInfo\x10\xcf\x01\x12\r\n\x08CopyLink\x10\xdc\x01\x12\ + \x12\n\rSetLatestView\x10\xdd\x01\x12\x13\n\x0eMoveFolderItem\x10\xe6\ + \x01\x12\x0e\n\tReadTrash\x10\xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\ + \x02\x12\x10\n\x0bDeleteTrash\x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\ + \x10\xaf\x02\x12\x13\n\x0eDeleteAllTrash\x10\xb0\x02b\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto b/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto index 80596900de..bb11f02509 100644 --- a/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto +++ b/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto @@ -16,10 +16,11 @@ enum FolderEvent { UpdateView = 203; DeleteView = 204; DuplicateView = 205; - CopyLink = 206; - SetLatestView = 207; - CloseView = 208; - MoveFolderItem = 209; + CloseView = 206; + ReadViewInfo = 207; + CopyLink = 220; + SetLatestView = 221; + MoveFolderItem = 230; ReadTrash = 300; PutbackTrash = 301; DeleteTrash = 302; diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs index 81aaa9bda6..54fcc3b522 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/mod.rs @@ -9,7 +9,6 @@ use crate::{ }; use flowy_database::ConnectionPool; use flowy_error::{FlowyError, FlowyResult}; - use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use flowy_revision::disk::{RevisionRecord, RevisionState}; use flowy_revision::mk_revision_disk_cache; diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs index 619aa156ca..f73c8c9e61 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_1/v1_impl.rs @@ -10,6 +10,7 @@ use flowy_database::DBConnection; use flowy_error::FlowyResult; use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; +/// V1Transaction is deprecated since version 0.0.2 version pub struct V1Transaction<'a>(pub &'a DBConnection); impl<'a> FolderPersistenceTransaction for V1Transaction<'a> { diff --git a/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs b/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs index 7a51ac4e88..44d63cf660 100644 --- a/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs +++ b/frontend/rust-lib/flowy-folder/src/services/persistence/version_2/v2_impl.rs @@ -3,7 +3,6 @@ use crate::services::{ persistence::{AppChangeset, FolderPersistenceTransaction, ViewChangeset, WorkspaceChangeset}, }; use flowy_error::{FlowyError, FlowyResult}; - use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision}; use std::sync::Arc; diff --git a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs index 54551fd431..ce701e705a 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs @@ -15,6 +15,7 @@ use crate::{ use bytes::Bytes; use flowy_database::kv::KV; use flowy_folder_data_model::entities::view::{gen_view_id, ViewDataType}; +use flowy_folder_data_model::entities::{ViewExtData, ViewInfo}; use flowy_folder_data_model::revision::ViewRevision; use flowy_sync::entities::text_block_info::TextBlockId; use futures::{FutureExt, StreamExt}; @@ -121,6 +122,36 @@ impl ViewController { Ok(view_rev) } + #[tracing::instrument(level = "debug", skip(self, view_id), fields(view_id = %view_id.value), err)] + pub(crate) async fn read_view_info(&self, view_id: ViewId) -> Result { + let view_info = self + .persistence + .begin_transaction(|transaction| { + let view_rev = transaction.read_view(&view_id.value)?; + + let items: Vec = view_rev + .belongings + .into_iter() + .map(|view_rev| view_rev.into()) + .collect(); + + let ext_data = ViewExtData::from(view_rev.ext_data); + let view_info = ViewInfo { + id: view_rev.id, + belong_to_id: view_rev.belong_to_id, + name: view_rev.name, + desc: view_rev.desc, + data_type: view_rev.data_type, + belongings: RepeatedView { items }, + ext_data, + }; + Ok(view_info) + }) + .await?; + + Ok(view_info) + } + pub(crate) async fn read_local_views(&self, ids: Vec) -> Result, FlowyError> { self.persistence .begin_transaction(|transaction| { diff --git a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs index 3714578cf4..cfacc23e0e 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs @@ -35,13 +35,12 @@ pub(crate) async fn read_view_handler( } pub(crate) async fn read_view_info_handler( - _data: Data, - _controller: AppData>, + data: Data, + controller: AppData>, ) -> DataResult { - // For the moment, app and view can contains lots of views. Reading the view - // belongings using the view_id. - // view.belongings = controller.read_views_belong_to(&view_id.value).await?; - todo!() + let view_id: ViewId = data.into_inner(); + let view_info = controller.read_view_info(view_id.clone()).await?; + data_result(view_info) } #[tracing::instrument(level = "debug", skip(data, controller), err)] diff --git a/frontend/rust-lib/flowy-grid/Cargo.toml b/frontend/rust-lib/flowy-grid/Cargo.toml index 1cf2ee0e53..ed793b4dc6 100644 --- a/frontend/rust-lib/flowy-grid/Cargo.toml +++ b/frontend/rust-lib/flowy-grid/Cargo.toml @@ -28,7 +28,7 @@ chrono = "0.4.19" nanoid = "0.4.0" bytes = { version = "1.0" } diesel = {version = "1.4.8", features = ["sqlite"]} -dashmap = "4.0" +dashmap = "5" tokio = {version = "1", features = ["sync"]} rayon = "1.5.2" serde = { version = "1.0", features = ["derive"] } diff --git a/frontend/rust-lib/flowy-net/Cargo.toml b/frontend/rust-lib/flowy-net/Cargo.toml index fe40f6981d..5ba64866e5 100644 --- a/frontend/rust-lib/flowy-net/Cargo.toml +++ b/frontend/rust-lib/flowy-net/Cargo.toml @@ -26,7 +26,7 @@ parking_lot = "0.11" strum = "0.21" strum_macros = "0.21" tracing = { version = "0.1", features = ["log"] } -dashmap = {version = "4.0"} +dashmap = "5" async-stream = "0.3.2" futures-util = "0.3.15" http-flowy = { git = "https://github.com/AppFlowy-IO/AppFlowy-Server", features = ["with_reqwest"] } diff --git a/frontend/rust-lib/flowy-revision/Cargo.toml b/frontend/rust-lib/flowy-revision/Cargo.toml index 504e05a2ce..90257699db 100644 --- a/frontend/rust-lib/flowy-revision/Cargo.toml +++ b/frontend/rust-lib/flowy-revision/Cargo.toml @@ -19,7 +19,7 @@ tokio = {version = "1", features = ["sync"]} bytes = { version = "1.1" } strum = "0.21" strum_macros = "0.21" -dashmap = "4.0" +dashmap = "5" serde = { version = "1.0", features = ["derive"] } futures-util = "0.3.15" async-stream = "0.3.2" diff --git a/frontend/rust-lib/flowy-text-block/Cargo.toml b/frontend/rust-lib/flowy-text-block/Cargo.toml index b71d61a8d4..576fa5cbcd 100644 --- a/frontend/rust-lib/flowy-text-block/Cargo.toml +++ b/frontend/rust-lib/flowy-text-block/Cargo.toml @@ -29,7 +29,7 @@ tracing = { version = "0.1", features = ["log"] } bytes = { version = "1.1" } strum = "0.21" strum_macros = "0.21" -dashmap = "4.0" +dashmap = "5" url = "2.2" serde = { version = "1.0", features = ["derive"] } serde_json = {version = "1.0"} diff --git a/frontend/rust-lib/lib-dispatch/Cargo.toml b/frontend/rust-lib/lib-dispatch/Cargo.toml index fd09f53956..cc3615ab4b 100644 --- a/frontend/rust-lib/lib-dispatch/Cargo.toml +++ b/frontend/rust-lib/lib-dispatch/Cargo.toml @@ -24,7 +24,7 @@ dyn-clone = "1.0" derivative = "2.2.0" serde_json = {version = "1.0"} serde = { version = "1.0", features = ["derive"] } -dashmap = "4.0" +dashmap = "5" #optional crate bincode = { version = "1.3", optional = true} diff --git a/shared-lib/Cargo.lock b/shared-lib/Cargo.lock index 03cf7bc02d..2ae77e2bd3 100644 --- a/shared-lib/Cargo.lock +++ b/shared-lib/Cargo.lock @@ -262,12 +262,13 @@ dependencies = [ [[package]] name = "dashmap" -version = "4.0.2" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" dependencies = [ "cfg-if", "num_cpus", + "parking_lot 0.12.1", ] [[package]] @@ -476,7 +477,7 @@ dependencies = [ "lib-ot", "log", "md5", - "parking_lot", + "parking_lot 0.11.2", "protobuf", "serde", "serde_json", @@ -881,7 +882,7 @@ dependencies = [ "futures-util", "lib-infra", "log", - "parking_lot", + "parking_lot 0.11.2", "paste", "pin-project", "protobuf", @@ -901,9 +902,9 @@ checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" dependencies = [ "scopeguard", ] @@ -1002,9 +1003,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -1046,7 +1047,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.5", +] + +[[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 0.9.3", ] [[package]] @@ -1063,6 +1074,19 @@ dependencies = [ "winapi", ] +[[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", + "smallvec", + "windows-sys", +] + [[package]] name = "parse-zoneinfo" version = "0.3.0" @@ -1624,7 +1648,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d" dependencies = [ "lazy_static", - "parking_lot", + "parking_lot 0.11.2", "serial_test_derive", ] @@ -1858,7 +1882,7 @@ dependencies = [ "mio", "num_cpus", "once_cell", - "parking_lot", + "parking_lot 0.11.2", "pin-project-lite", "signal-hook-registry", "tokio-macros", @@ -2178,3 +2202,46 @@ 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", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[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_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[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_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" diff --git a/shared-lib/flowy-derive/Cargo.toml b/shared-lib/flowy-derive/Cargo.toml index 0623cd7428..5346ea52e9 100644 --- a/shared-lib/flowy-derive/Cargo.toml +++ b/shared-lib/flowy-derive/Cargo.toml @@ -19,7 +19,7 @@ quote = "1.0" proc-macro2 = "1.0" flowy-ast = { path = "../flowy-ast" } lazy_static = {version = "1.4.0"} -dashmap = "4.0" +dashmap = "5" lib-infra = { path = "../lib-infra", features = ["proto_gen"]} serde_json = "1.0" walkdir = "2.3.1" diff --git a/shared-lib/flowy-sync/Cargo.toml b/shared-lib/flowy-sync/Cargo.toml index 6c66a21999..154054e9a8 100644 --- a/shared-lib/flowy-sync/Cargo.toml +++ b/shared-lib/flowy-sync/Cargo.toml @@ -25,7 +25,7 @@ strum = "0.21" strum_macros = "0.21" chrono = "0.4.19" parking_lot = "0.11" -dashmap = "4.0" +dashmap = "5" futures = "0.3.15" async-stream = "0.3.2" diff --git a/shared-lib/lib-ot/Cargo.toml b/shared-lib/lib-ot/Cargo.toml index c41f9dfbde..a1a577132e 100644 --- a/shared-lib/lib-ot/Cargo.toml +++ b/shared-lib/lib-ot/Cargo.toml @@ -11,7 +11,7 @@ serde = { version = "1.0", features = ["derive"] } #protobuf = {version = "2.18.0"} #flowy-derive = { path = "../flowy-derive" } tokio = {version = "1", features = ["sync"]} -dashmap = "4.0" +dashmap = "5" md5 = "0.7.0" anyhow = "1.0" thiserror = "1.0" diff --git a/shared-lib/lib-ws/Cargo.toml b/shared-lib/lib-ws/Cargo.toml index 53b55fd295..003bdf43bd 100644 --- a/shared-lib/lib-ws/Cargo.toml +++ b/shared-lib/lib-ws/Cargo.toml @@ -25,7 +25,7 @@ protobuf = {version = "2.18.0"} strum = "0.21" strum_macros = "0.21" parking_lot = "0.11" -dashmap = "4.0" +dashmap = "5" [build-dependencies] lib-infra = { path = "../lib-infra", features = ["protobuf_file_gen"] } From 298b80f4c5f4abc62f89b0831dc4c48c98b82e77 Mon Sep 17 00:00:00 2001 From: appflowy Date: Tue, 14 Jun 2022 08:46:11 +0800 Subject: [PATCH 07/11] chore: fix dependabot alerts for crassbeam-utils and regex --- frontend/rust-lib/Cargo.lock | 14 ++++++++------ frontend/rust-lib/dart-ffi/Cargo.toml | 2 ++ frontend/rust-lib/flowy-grid/Cargo.toml | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index 1b3e960e05..e150152ccd 100755 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -489,9 +489,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ "cfg-if", "lazy_static", @@ -561,6 +561,7 @@ dependencies = [ "allo-isolate", "byteorder", "bytes", + "crossbeam-utils", "dart-notify", "ffi-support", "flowy-derive", @@ -947,6 +948,7 @@ dependencies = [ "nanoid", "protobuf", "rayon", + "regex", "rust_decimal", "rusty-money", "serde", @@ -2676,9 +2678,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.4" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" dependencies = [ "aho-corasick", "memchr", @@ -2696,9 +2698,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" [[package]] name = "remove_dir_all" diff --git a/frontend/rust-lib/dart-ffi/Cargo.toml b/frontend/rust-lib/dart-ffi/Cargo.toml index bbc3c3f35b..44fd254cbb 100644 --- a/frontend/rust-lib/dart-ffi/Cargo.toml +++ b/frontend/rust-lib/dart-ffi/Cargo.toml @@ -22,6 +22,8 @@ serde = { version = "1.0", features = ["derive"] } serde_json = {version = "1.0"} bytes = { version = "1.0" } once_cell = "1" +crossbeam-utils = "0.8.7" + lib-dispatch = {path = "../lib-dispatch" } flowy-sdk = {path = "../flowy-sdk"} diff --git a/frontend/rust-lib/flowy-grid/Cargo.toml b/frontend/rust-lib/flowy-grid/Cargo.toml index ed793b4dc6..1cf38dbb3f 100644 --- a/frontend/rust-lib/flowy-grid/Cargo.toml +++ b/frontend/rust-lib/flowy-grid/Cargo.toml @@ -36,6 +36,7 @@ serde_json = {version = "1.0"} serde_repr = "0.1" indexmap = {version = "1.8.1", features = ["serde"]} fancy-regex = "0.10.0" +regex = "1.5.6" url = { version = "2"} futures = "0.3.15" From d4d7ba7452bec03951e86860702576f7324a9dd4 Mon Sep 17 00:00:00 2001 From: appflowy Date: Tue, 14 Jun 2022 23:11:48 +0800 Subject: [PATCH 08/11] chore: read view info --- .../flowy-folder-data-model/protobuf.dart | 1 + .../flowy-folder-data-model/view.pb.dart | 466 +---- .../flowy-folder-data-model/view.pbjson.dart | 82 +- .../flowy-folder-data-model/view_info.pb.dart | 399 ++++ .../view_info.pbenum.dart | 7 + .../view_info.pbjson.dart | 72 + .../view_info.pbserver.dart | 9 + .../rust-lib/flowy-folder/src/event_map.rs | 6 +- .../src/services/view/event_handler.rs | 11 + .../src/entities/mod.rs | 2 + .../src/entities/view.rs | 106 +- .../src/entities/view_info.rs | 84 + .../src/protobuf/model/mod.rs | 3 + .../src/protobuf/model/view.rs | 1670 ++--------------- .../src/protobuf/model/view_info.rs | 1331 +++++++++++++ .../src/protobuf/proto/view.proto | 30 +- .../src/protobuf/proto/view_info.proto | 27 + 17 files changed, 2209 insertions(+), 2097 deletions(-) create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbenum.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbserver.dart create mode 100644 shared-lib/flowy-folder-data-model/src/entities/view_info.rs create mode 100644 shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs create mode 100644 shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/protobuf.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/protobuf.dart index 4ca4fa1fd1..fe05a53682 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/protobuf.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/protobuf.dart @@ -1,5 +1,6 @@ // Auto-generated, do not edit export './app.pb.dart'; +export './view_info.pb.dart'; export './view.pb.dart'; export './trash.pb.dart'; export './workspace.pb.dart'; diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart index 42d99339b7..b62668c488 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pb.dart @@ -145,390 +145,6 @@ class View extends $pb.GeneratedMessage { void clearPluginType() => clearField(7); } -class ViewInfo extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewInfo', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongToId') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') - ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dataType', $pb.PbFieldType.OE, defaultOrMaker: ViewDataType.TextBlock, valueOf: ViewDataType.valueOf, enumValues: ViewDataType.values) - ..aOM(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: RepeatedView.create) - ..aOM(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'extData', subBuilder: ViewExtData.create) - ..hasRequiredFields = false - ; - - ViewInfo._() : super(); - factory ViewInfo({ - $core.String? id, - $core.String? belongToId, - $core.String? name, - $core.String? desc, - ViewDataType? dataType, - RepeatedView? belongings, - ViewExtData? extData, - }) { - final _result = create(); - if (id != null) { - _result.id = id; - } - if (belongToId != null) { - _result.belongToId = belongToId; - } - if (name != null) { - _result.name = name; - } - if (desc != null) { - _result.desc = desc; - } - if (dataType != null) { - _result.dataType = dataType; - } - if (belongings != null) { - _result.belongings = belongings; - } - if (extData != null) { - _result.extData = extData; - } - return _result; - } - factory ViewInfo.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewInfo.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewInfo clone() => ViewInfo()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewInfo copyWith(void Function(ViewInfo) updates) => super.copyWith((message) => updates(message as ViewInfo)) as ViewInfo; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewInfo create() => ViewInfo._(); - ViewInfo createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewInfo getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewInfo? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get id => $_getSZ(0); - @$pb.TagNumber(1) - set id($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasId() => $_has(0); - @$pb.TagNumber(1) - void clearId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get belongToId => $_getSZ(1); - @$pb.TagNumber(2) - set belongToId($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasBelongToId() => $_has(1); - @$pb.TagNumber(2) - void clearBelongToId() => clearField(2); - - @$pb.TagNumber(3) - $core.String get name => $_getSZ(2); - @$pb.TagNumber(3) - set name($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasName() => $_has(2); - @$pb.TagNumber(3) - void clearName() => clearField(3); - - @$pb.TagNumber(4) - $core.String get desc => $_getSZ(3); - @$pb.TagNumber(4) - set desc($core.String v) { $_setString(3, v); } - @$pb.TagNumber(4) - $core.bool hasDesc() => $_has(3); - @$pb.TagNumber(4) - void clearDesc() => clearField(4); - - @$pb.TagNumber(5) - ViewDataType get dataType => $_getN(4); - @$pb.TagNumber(5) - set dataType(ViewDataType v) { setField(5, v); } - @$pb.TagNumber(5) - $core.bool hasDataType() => $_has(4); - @$pb.TagNumber(5) - void clearDataType() => clearField(5); - - @$pb.TagNumber(6) - RepeatedView get belongings => $_getN(5); - @$pb.TagNumber(6) - set belongings(RepeatedView v) { setField(6, v); } - @$pb.TagNumber(6) - $core.bool hasBelongings() => $_has(5); - @$pb.TagNumber(6) - void clearBelongings() => clearField(6); - @$pb.TagNumber(6) - RepeatedView ensureBelongings() => $_ensure(5); - - @$pb.TagNumber(7) - ViewExtData get extData => $_getN(6); - @$pb.TagNumber(7) - set extData(ViewExtData v) { setField(7, v); } - @$pb.TagNumber(7) - $core.bool hasExtData() => $_has(6); - @$pb.TagNumber(7) - void clearExtData() => clearField(7); - @$pb.TagNumber(7) - ViewExtData ensureExtData() => $_ensure(6); -} - -class ViewExtData extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewExtData', createEmptyInstance: create) - ..aOM(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) - ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) - ..hasRequiredFields = false - ; - - ViewExtData._() : super(); - factory ViewExtData({ - ViewFilter? filter, - ViewGroup? group, - ViewSort? sort, - }) { - final _result = create(); - if (filter != null) { - _result.filter = filter; - } - if (group != null) { - _result.group = group; - } - if (sort != null) { - _result.sort = sort; - } - return _result; - } - factory ViewExtData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewExtData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewExtData clone() => ViewExtData()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewExtData copyWith(void Function(ViewExtData) updates) => super.copyWith((message) => updates(message as ViewExtData)) as ViewExtData; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewExtData create() => ViewExtData._(); - ViewExtData createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewExtData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewExtData? _defaultInstance; - - @$pb.TagNumber(1) - ViewFilter get filter => $_getN(0); - @$pb.TagNumber(1) - set filter(ViewFilter v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasFilter() => $_has(0); - @$pb.TagNumber(1) - void clearFilter() => clearField(1); - @$pb.TagNumber(1) - ViewFilter ensureFilter() => $_ensure(0); - - @$pb.TagNumber(2) - ViewGroup get group => $_getN(1); - @$pb.TagNumber(2) - set group(ViewGroup v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasGroup() => $_has(1); - @$pb.TagNumber(2) - void clearGroup() => clearField(2); - @$pb.TagNumber(2) - ViewGroup ensureGroup() => $_ensure(1); - - @$pb.TagNumber(3) - ViewSort get sort => $_getN(2); - @$pb.TagNumber(3) - set sort(ViewSort v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasSort() => $_has(2); - @$pb.TagNumber(3) - void clearSort() => clearField(3); - @$pb.TagNumber(3) - ViewSort ensureSort() => $_ensure(2); -} - -class ViewFilter extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewFilter', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') - ..hasRequiredFields = false - ; - - ViewFilter._() : super(); - factory ViewFilter({ - $core.String? fieldId, - }) { - final _result = create(); - if (fieldId != null) { - _result.fieldId = fieldId; - } - return _result; - } - factory ViewFilter.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewFilter.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewFilter clone() => ViewFilter()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewFilter copyWith(void Function(ViewFilter) updates) => super.copyWith((message) => updates(message as ViewFilter)) as ViewFilter; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewFilter create() => ViewFilter._(); - ViewFilter createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewFilter getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewFilter? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get fieldId => $_getSZ(0); - @$pb.TagNumber(1) - set fieldId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasFieldId() => $_has(0); - @$pb.TagNumber(1) - void clearFieldId() => clearField(1); -} - -enum ViewGroup_OneOfSubGroupFieldId { - subGroupFieldId, - notSet -} - -class ViewGroup extends $pb.GeneratedMessage { - static const $core.Map<$core.int, ViewGroup_OneOfSubGroupFieldId> _ViewGroup_OneOfSubGroupFieldIdByTag = { - 2 : ViewGroup_OneOfSubGroupFieldId.subGroupFieldId, - 0 : ViewGroup_OneOfSubGroupFieldId.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewGroup', createEmptyInstance: create) - ..oo(0, [2]) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'groupFieldId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subGroupFieldId') - ..hasRequiredFields = false - ; - - ViewGroup._() : super(); - factory ViewGroup({ - $core.String? groupFieldId, - $core.String? subGroupFieldId, - }) { - final _result = create(); - if (groupFieldId != null) { - _result.groupFieldId = groupFieldId; - } - if (subGroupFieldId != null) { - _result.subGroupFieldId = subGroupFieldId; - } - return _result; - } - factory ViewGroup.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewGroup.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewGroup clone() => ViewGroup()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewGroup copyWith(void Function(ViewGroup) updates) => super.copyWith((message) => updates(message as ViewGroup)) as ViewGroup; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewGroup create() => ViewGroup._(); - ViewGroup createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewGroup getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewGroup? _defaultInstance; - - ViewGroup_OneOfSubGroupFieldId whichOneOfSubGroupFieldId() => _ViewGroup_OneOfSubGroupFieldIdByTag[$_whichOneof(0)]!; - void clearOneOfSubGroupFieldId() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - $core.String get groupFieldId => $_getSZ(0); - @$pb.TagNumber(1) - set groupFieldId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGroupFieldId() => $_has(0); - @$pb.TagNumber(1) - void clearGroupFieldId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get subGroupFieldId => $_getSZ(1); - @$pb.TagNumber(2) - set subGroupFieldId($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasSubGroupFieldId() => $_has(1); - @$pb.TagNumber(2) - void clearSubGroupFieldId() => clearField(2); -} - -class ViewSort extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewSort', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') - ..hasRequiredFields = false - ; - - ViewSort._() : super(); - factory ViewSort({ - $core.String? fieldId, - }) { - final _result = create(); - if (fieldId != null) { - _result.fieldId = fieldId; - } - return _result; - } - factory ViewSort.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewSort.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewSort clone() => ViewSort()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewSort copyWith(void Function(ViewSort) updates) => super.copyWith((message) => updates(message as ViewSort)) as ViewSort; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewSort create() => ViewSort._(); - ViewSort createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewSort getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewSort? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get fieldId => $_getSZ(0); - @$pb.TagNumber(1) - set fieldId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasFieldId() => $_has(0); - @$pb.TagNumber(1) - void clearFieldId() => clearField(1); -} - class RepeatedView extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedView', createEmptyInstance: create) ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: View.create) @@ -570,6 +186,47 @@ class RepeatedView extends $pb.GeneratedMessage { $core.List get items => $_getList(0); } +class RepeatedViewId extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedViewId', createEmptyInstance: create) + ..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items') + ..hasRequiredFields = false + ; + + RepeatedViewId._() : super(); + factory RepeatedViewId({ + $core.Iterable<$core.String>? items, + }) { + final _result = create(); + if (items != null) { + _result.items.addAll(items); + } + return _result; + } + factory RepeatedViewId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory RepeatedViewId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + RepeatedViewId clone() => RepeatedViewId()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + RepeatedViewId copyWith(void Function(RepeatedViewId) updates) => super.copyWith((message) => updates(message as RepeatedViewId)) as RepeatedViewId; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static RepeatedViewId create() => RepeatedViewId._(); + RepeatedViewId createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static RepeatedViewId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RepeatedViewId? _defaultInstance; + + @$pb.TagNumber(1) + $core.List<$core.String> get items => $_getList(0); +} + enum CreateViewPayload_OneOfThumbnail { thumbnail, notSet @@ -906,47 +563,6 @@ class ViewId extends $pb.GeneratedMessage { void clearValue() => clearField(1); } -class RepeatedViewId extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedViewId', createEmptyInstance: create) - ..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items') - ..hasRequiredFields = false - ; - - RepeatedViewId._() : super(); - factory RepeatedViewId({ - $core.Iterable<$core.String>? items, - }) { - final _result = create(); - if (items != null) { - _result.items.addAll(items); - } - return _result; - } - factory RepeatedViewId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RepeatedViewId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - RepeatedViewId clone() => RepeatedViewId()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - RepeatedViewId copyWith(void Function(RepeatedViewId) updates) => super.copyWith((message) => updates(message as RepeatedViewId)) as RepeatedViewId; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static RepeatedViewId create() => RepeatedViewId._(); - RepeatedViewId createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static RepeatedViewId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static RepeatedViewId? _defaultInstance; - - @$pb.TagNumber(1) - $core.List<$core.String> get items => $_getList(0); -} - enum UpdateViewPayload_OneOfName { name, notSet diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart index b83147e64e..1574f527c4 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view.pbjson.dart @@ -46,68 +46,6 @@ const View$json = const { /// Descriptor for `View`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List viewDescriptor = $convert.base64Decode('CgRWaWV3Eg4KAmlkGAEgASgJUgJpZBIgCgxiZWxvbmdfdG9faWQYAiABKAlSCmJlbG9uZ1RvSWQSEgoEbmFtZRgDIAEoCVIEbmFtZRIqCglkYXRhX3R5cGUYBCABKA4yDS5WaWV3RGF0YVR5cGVSCGRhdGFUeXBlEiMKDW1vZGlmaWVkX3RpbWUYBSABKANSDG1vZGlmaWVkVGltZRIfCgtjcmVhdGVfdGltZRgGIAEoA1IKY3JlYXRlVGltZRIfCgtwbHVnaW5fdHlwZRgHIAEoBVIKcGx1Z2luVHlwZQ=='); -@$core.Deprecated('Use viewInfoDescriptor instead') -const ViewInfo$json = const { - '1': 'ViewInfo', - '2': const [ - const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, - const {'1': 'belong_to_id', '3': 2, '4': 1, '5': 9, '10': 'belongToId'}, - const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, - const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'}, - const {'1': 'data_type', '3': 5, '4': 1, '5': 14, '6': '.ViewDataType', '10': 'dataType'}, - const {'1': 'belongings', '3': 6, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'belongings'}, - const {'1': 'ext_data', '3': 7, '4': 1, '5': 11, '6': '.ViewExtData', '10': 'extData'}, - ], -}; - -/// Descriptor for `ViewInfo`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewInfoDescriptor = $convert.base64Decode('CghWaWV3SW5mbxIOCgJpZBgBIAEoCVICaWQSIAoMYmVsb25nX3RvX2lkGAIgASgJUgpiZWxvbmdUb0lkEhIKBG5hbWUYAyABKAlSBG5hbWUSEgoEZGVzYxgEIAEoCVIEZGVzYxIqCglkYXRhX3R5cGUYBSABKA4yDS5WaWV3RGF0YVR5cGVSCGRhdGFUeXBlEi0KCmJlbG9uZ2luZ3MYBiABKAsyDS5SZXBlYXRlZFZpZXdSCmJlbG9uZ2luZ3MSJwoIZXh0X2RhdGEYByABKAsyDC5WaWV3RXh0RGF0YVIHZXh0RGF0YQ=='); -@$core.Deprecated('Use viewExtDataDescriptor instead') -const ViewExtData$json = const { - '1': 'ViewExtData', - '2': const [ - const {'1': 'filter', '3': 1, '4': 1, '5': 11, '6': '.ViewFilter', '10': 'filter'}, - const {'1': 'group', '3': 2, '4': 1, '5': 11, '6': '.ViewGroup', '10': 'group'}, - const {'1': 'sort', '3': 3, '4': 1, '5': 11, '6': '.ViewSort', '10': 'sort'}, - ], -}; - -/// Descriptor for `ViewExtData`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewExtDataDescriptor = $convert.base64Decode('CgtWaWV3RXh0RGF0YRIjCgZmaWx0ZXIYASABKAsyCy5WaWV3RmlsdGVyUgZmaWx0ZXISIAoFZ3JvdXAYAiABKAsyCi5WaWV3R3JvdXBSBWdyb3VwEh0KBHNvcnQYAyABKAsyCS5WaWV3U29ydFIEc29ydA=='); -@$core.Deprecated('Use viewFilterDescriptor instead') -const ViewFilter$json = const { - '1': 'ViewFilter', - '2': const [ - const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, - ], -}; - -/// Descriptor for `ViewFilter`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewFilterDescriptor = $convert.base64Decode('CgpWaWV3RmlsdGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElk'); -@$core.Deprecated('Use viewGroupDescriptor instead') -const ViewGroup$json = const { - '1': 'ViewGroup', - '2': const [ - const {'1': 'group_field_id', '3': 1, '4': 1, '5': 9, '10': 'groupFieldId'}, - const {'1': 'sub_group_field_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'subGroupFieldId'}, - ], - '8': const [ - const {'1': 'one_of_sub_group_field_id'}, - ], -}; - -/// Descriptor for `ViewGroup`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewGroupDescriptor = $convert.base64Decode('CglWaWV3R3JvdXASJAoOZ3JvdXBfZmllbGRfaWQYASABKAlSDGdyb3VwRmllbGRJZBItChJzdWJfZ3JvdXBfZmllbGRfaWQYAiABKAlIAFIPc3ViR3JvdXBGaWVsZElkQhsKGW9uZV9vZl9zdWJfZ3JvdXBfZmllbGRfaWQ='); -@$core.Deprecated('Use viewSortDescriptor instead') -const ViewSort$json = const { - '1': 'ViewSort', - '2': const [ - const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, - ], -}; - -/// Descriptor for `ViewSort`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewSortDescriptor = $convert.base64Decode('CghWaWV3U29ydBIZCghmaWVsZF9pZBgBIAEoCVIHZmllbGRJZA=='); @$core.Deprecated('Use repeatedViewDescriptor instead') const RepeatedView$json = const { '1': 'RepeatedView', @@ -118,6 +56,16 @@ const RepeatedView$json = const { /// Descriptor for `RepeatedView`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List repeatedViewDescriptor = $convert.base64Decode('CgxSZXBlYXRlZFZpZXcSGwoFaXRlbXMYASADKAsyBS5WaWV3UgVpdGVtcw=='); +@$core.Deprecated('Use repeatedViewIdDescriptor instead') +const RepeatedViewId$json = const { + '1': 'RepeatedViewId', + '2': const [ + const {'1': 'items', '3': 1, '4': 3, '5': 9, '10': 'items'}, + ], +}; + +/// Descriptor for `RepeatedViewId`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List repeatedViewIdDescriptor = $convert.base64Decode('Cg5SZXBlYXRlZFZpZXdJZBIUCgVpdGVtcxgBIAMoCVIFaXRlbXM='); @$core.Deprecated('Use createViewPayloadDescriptor instead') const CreateViewPayload$json = const { '1': 'CreateViewPayload', @@ -164,16 +112,6 @@ const ViewId$json = const { /// Descriptor for `ViewId`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List viewIdDescriptor = $convert.base64Decode('CgZWaWV3SWQSFAoFdmFsdWUYASABKAlSBXZhbHVl'); -@$core.Deprecated('Use repeatedViewIdDescriptor instead') -const RepeatedViewId$json = const { - '1': 'RepeatedViewId', - '2': const [ - const {'1': 'items', '3': 1, '4': 3, '5': 9, '10': 'items'}, - ], -}; - -/// Descriptor for `RepeatedViewId`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List repeatedViewIdDescriptor = $convert.base64Decode('Cg5SZXBlYXRlZFZpZXdJZBIUCgVpdGVtcxgBIAMoCVIFaXRlbXM='); @$core.Deprecated('Use updateViewPayloadDescriptor instead') const UpdateViewPayload$json = const { '1': 'UpdateViewPayload', diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart new file mode 100644 index 0000000000..11d6115cfb --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart @@ -0,0 +1,399 @@ +/// +// Generated code. Do not modify. +// source: view_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import 'view.pb.dart' as $0; + +import 'view.pbenum.dart' as $0; + +class ViewInfo extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewInfo', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongToId') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') + ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') + ..e<$0.ViewDataType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dataType', $pb.PbFieldType.OE, defaultOrMaker: $0.ViewDataType.TextBlock, valueOf: $0.ViewDataType.valueOf, enumValues: $0.ViewDataType.values) + ..aOM<$0.RepeatedView>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: $0.RepeatedView.create) + ..aOM(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'extData', subBuilder: ViewExtData.create) + ..hasRequiredFields = false + ; + + ViewInfo._() : super(); + factory ViewInfo({ + $core.String? id, + $core.String? belongToId, + $core.String? name, + $core.String? desc, + $0.ViewDataType? dataType, + $0.RepeatedView? belongings, + ViewExtData? extData, + }) { + final _result = create(); + if (id != null) { + _result.id = id; + } + if (belongToId != null) { + _result.belongToId = belongToId; + } + if (name != null) { + _result.name = name; + } + if (desc != null) { + _result.desc = desc; + } + if (dataType != null) { + _result.dataType = dataType; + } + if (belongings != null) { + _result.belongings = belongings; + } + if (extData != null) { + _result.extData = extData; + } + return _result; + } + factory ViewInfo.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewInfo.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewInfo clone() => ViewInfo()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewInfo copyWith(void Function(ViewInfo) updates) => super.copyWith((message) => updates(message as ViewInfo)) as ViewInfo; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewInfo create() => ViewInfo._(); + ViewInfo createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewInfo getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewInfo? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get belongToId => $_getSZ(1); + @$pb.TagNumber(2) + set belongToId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasBelongToId() => $_has(1); + @$pb.TagNumber(2) + void clearBelongToId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get desc => $_getSZ(3); + @$pb.TagNumber(4) + set desc($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasDesc() => $_has(3); + @$pb.TagNumber(4) + void clearDesc() => clearField(4); + + @$pb.TagNumber(5) + $0.ViewDataType get dataType => $_getN(4); + @$pb.TagNumber(5) + set dataType($0.ViewDataType v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasDataType() => $_has(4); + @$pb.TagNumber(5) + void clearDataType() => clearField(5); + + @$pb.TagNumber(6) + $0.RepeatedView get belongings => $_getN(5); + @$pb.TagNumber(6) + set belongings($0.RepeatedView v) { setField(6, v); } + @$pb.TagNumber(6) + $core.bool hasBelongings() => $_has(5); + @$pb.TagNumber(6) + void clearBelongings() => clearField(6); + @$pb.TagNumber(6) + $0.RepeatedView ensureBelongings() => $_ensure(5); + + @$pb.TagNumber(7) + ViewExtData get extData => $_getN(6); + @$pb.TagNumber(7) + set extData(ViewExtData v) { setField(7, v); } + @$pb.TagNumber(7) + $core.bool hasExtData() => $_has(6); + @$pb.TagNumber(7) + void clearExtData() => clearField(7); + @$pb.TagNumber(7) + ViewExtData ensureExtData() => $_ensure(6); +} + +class ViewExtData extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewExtData', createEmptyInstance: create) + ..aOM(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) + ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) + ..hasRequiredFields = false + ; + + ViewExtData._() : super(); + factory ViewExtData({ + ViewFilter? filter, + ViewGroup? group, + ViewSort? sort, + }) { + final _result = create(); + if (filter != null) { + _result.filter = filter; + } + if (group != null) { + _result.group = group; + } + if (sort != null) { + _result.sort = sort; + } + return _result; + } + factory ViewExtData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewExtData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewExtData clone() => ViewExtData()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewExtData copyWith(void Function(ViewExtData) updates) => super.copyWith((message) => updates(message as ViewExtData)) as ViewExtData; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewExtData create() => ViewExtData._(); + ViewExtData createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewExtData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewExtData? _defaultInstance; + + @$pb.TagNumber(1) + ViewFilter get filter => $_getN(0); + @$pb.TagNumber(1) + set filter(ViewFilter v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasFilter() => $_has(0); + @$pb.TagNumber(1) + void clearFilter() => clearField(1); + @$pb.TagNumber(1) + ViewFilter ensureFilter() => $_ensure(0); + + @$pb.TagNumber(2) + ViewGroup get group => $_getN(1); + @$pb.TagNumber(2) + set group(ViewGroup v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasGroup() => $_has(1); + @$pb.TagNumber(2) + void clearGroup() => clearField(2); + @$pb.TagNumber(2) + ViewGroup ensureGroup() => $_ensure(1); + + @$pb.TagNumber(3) + ViewSort get sort => $_getN(2); + @$pb.TagNumber(3) + set sort(ViewSort v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasSort() => $_has(2); + @$pb.TagNumber(3) + void clearSort() => clearField(3); + @$pb.TagNumber(3) + ViewSort ensureSort() => $_ensure(2); +} + +class ViewFilter extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewFilter', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..hasRequiredFields = false + ; + + ViewFilter._() : super(); + factory ViewFilter({ + $core.String? fieldId, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + return _result; + } + factory ViewFilter.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewFilter.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewFilter clone() => ViewFilter()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewFilter copyWith(void Function(ViewFilter) updates) => super.copyWith((message) => updates(message as ViewFilter)) as ViewFilter; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewFilter create() => ViewFilter._(); + ViewFilter createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewFilter getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewFilter? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); +} + +enum ViewGroup_OneOfSubGroupFieldId { + subGroupFieldId, + notSet +} + +class ViewGroup extends $pb.GeneratedMessage { + static const $core.Map<$core.int, ViewGroup_OneOfSubGroupFieldId> _ViewGroup_OneOfSubGroupFieldIdByTag = { + 2 : ViewGroup_OneOfSubGroupFieldId.subGroupFieldId, + 0 : ViewGroup_OneOfSubGroupFieldId.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewGroup', createEmptyInstance: create) + ..oo(0, [2]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'groupFieldId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subGroupFieldId') + ..hasRequiredFields = false + ; + + ViewGroup._() : super(); + factory ViewGroup({ + $core.String? groupFieldId, + $core.String? subGroupFieldId, + }) { + final _result = create(); + if (groupFieldId != null) { + _result.groupFieldId = groupFieldId; + } + if (subGroupFieldId != null) { + _result.subGroupFieldId = subGroupFieldId; + } + return _result; + } + factory ViewGroup.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewGroup.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewGroup clone() => ViewGroup()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewGroup copyWith(void Function(ViewGroup) updates) => super.copyWith((message) => updates(message as ViewGroup)) as ViewGroup; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewGroup create() => ViewGroup._(); + ViewGroup createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewGroup getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewGroup? _defaultInstance; + + ViewGroup_OneOfSubGroupFieldId whichOneOfSubGroupFieldId() => _ViewGroup_OneOfSubGroupFieldIdByTag[$_whichOneof(0)]!; + void clearOneOfSubGroupFieldId() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.String get groupFieldId => $_getSZ(0); + @$pb.TagNumber(1) + set groupFieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGroupFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearGroupFieldId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get subGroupFieldId => $_getSZ(1); + @$pb.TagNumber(2) + set subGroupFieldId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasSubGroupFieldId() => $_has(1); + @$pb.TagNumber(2) + void clearSubGroupFieldId() => clearField(2); +} + +class ViewSort extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewSort', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..hasRequiredFields = false + ; + + ViewSort._() : super(); + factory ViewSort({ + $core.String? fieldId, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + return _result; + } + factory ViewSort.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewSort.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewSort clone() => ViewSort()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewSort copyWith(void Function(ViewSort) updates) => super.copyWith((message) => updates(message as ViewSort)) as ViewSort; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewSort create() => ViewSort._(); + ViewSort createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewSort getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewSort? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); +} + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbenum.dart new file mode 100644 index 0000000000..d242b16359 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbenum.dart @@ -0,0 +1,7 @@ +/// +// Generated code. Do not modify. +// source: view_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart new file mode 100644 index 0000000000..6aff03111d --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart @@ -0,0 +1,72 @@ +/// +// Generated code. Do not modify. +// source: view_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use viewInfoDescriptor instead') +const ViewInfo$json = const { + '1': 'ViewInfo', + '2': const [ + const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + const {'1': 'belong_to_id', '3': 2, '4': 1, '5': 9, '10': 'belongToId'}, + const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, + const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'}, + const {'1': 'data_type', '3': 5, '4': 1, '5': 14, '6': '.ViewDataType', '10': 'dataType'}, + const {'1': 'belongings', '3': 6, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'belongings'}, + const {'1': 'ext_data', '3': 7, '4': 1, '5': 11, '6': '.ViewExtData', '10': 'extData'}, + ], +}; + +/// Descriptor for `ViewInfo`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewInfoDescriptor = $convert.base64Decode('CghWaWV3SW5mbxIOCgJpZBgBIAEoCVICaWQSIAoMYmVsb25nX3RvX2lkGAIgASgJUgpiZWxvbmdUb0lkEhIKBG5hbWUYAyABKAlSBG5hbWUSEgoEZGVzYxgEIAEoCVIEZGVzYxIqCglkYXRhX3R5cGUYBSABKA4yDS5WaWV3RGF0YVR5cGVSCGRhdGFUeXBlEi0KCmJlbG9uZ2luZ3MYBiABKAsyDS5SZXBlYXRlZFZpZXdSCmJlbG9uZ2luZ3MSJwoIZXh0X2RhdGEYByABKAsyDC5WaWV3RXh0RGF0YVIHZXh0RGF0YQ=='); +@$core.Deprecated('Use viewExtDataDescriptor instead') +const ViewExtData$json = const { + '1': 'ViewExtData', + '2': const [ + const {'1': 'filter', '3': 1, '4': 1, '5': 11, '6': '.ViewFilter', '10': 'filter'}, + const {'1': 'group', '3': 2, '4': 1, '5': 11, '6': '.ViewGroup', '10': 'group'}, + const {'1': 'sort', '3': 3, '4': 1, '5': 11, '6': '.ViewSort', '10': 'sort'}, + ], +}; + +/// Descriptor for `ViewExtData`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewExtDataDescriptor = $convert.base64Decode('CgtWaWV3RXh0RGF0YRIjCgZmaWx0ZXIYASABKAsyCy5WaWV3RmlsdGVyUgZmaWx0ZXISIAoFZ3JvdXAYAiABKAsyCi5WaWV3R3JvdXBSBWdyb3VwEh0KBHNvcnQYAyABKAsyCS5WaWV3U29ydFIEc29ydA=='); +@$core.Deprecated('Use viewFilterDescriptor instead') +const ViewFilter$json = const { + '1': 'ViewFilter', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + ], +}; + +/// Descriptor for `ViewFilter`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewFilterDescriptor = $convert.base64Decode('CgpWaWV3RmlsdGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElk'); +@$core.Deprecated('Use viewGroupDescriptor instead') +const ViewGroup$json = const { + '1': 'ViewGroup', + '2': const [ + const {'1': 'group_field_id', '3': 1, '4': 1, '5': 9, '10': 'groupFieldId'}, + const {'1': 'sub_group_field_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'subGroupFieldId'}, + ], + '8': const [ + const {'1': 'one_of_sub_group_field_id'}, + ], +}; + +/// Descriptor for `ViewGroup`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewGroupDescriptor = $convert.base64Decode('CglWaWV3R3JvdXASJAoOZ3JvdXBfZmllbGRfaWQYASABKAlSDGdyb3VwRmllbGRJZBItChJzdWJfZ3JvdXBfZmllbGRfaWQYAiABKAlIAFIPc3ViR3JvdXBGaWVsZElkQhsKGW9uZV9vZl9zdWJfZ3JvdXBfZmllbGRfaWQ='); +@$core.Deprecated('Use viewSortDescriptor instead') +const ViewSort$json = const { + '1': 'ViewSort', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + ], +}; + +/// Descriptor for `ViewSort`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewSortDescriptor = $convert.base64Decode('CghWaWV3U29ydBIZCghmaWVsZF9pZBgBIAEoCVIHZmllbGRJZA=='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbserver.dart new file mode 100644 index 0000000000..8d78c9f49a --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbserver.dart @@ -0,0 +1,9 @@ +/// +// Generated code. Do not modify. +// source: view_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +export 'view_info.pb.dart'; + diff --git a/frontend/rust-lib/flowy-folder/src/event_map.rs b/frontend/rust-lib/flowy-folder/src/event_map.rs index bc2afa9491..b1a0b186a3 100644 --- a/frontend/rust-lib/flowy-folder/src/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/event_map.rs @@ -59,8 +59,9 @@ pub fn create(folder: Arc) -> Module { module = module .event(FolderEvent::CreateView, create_view_handler) .event(FolderEvent::ReadView, read_view_handler) - .event(FolderEvent::ReadViewInfo, read_view_info_handler) .event(FolderEvent::UpdateView, update_view_handler) + .event(FolderEvent::ReadViewInfo, read_view_info_handler) + .event(FolderEvent::UpdateViewInfo, update_view_info_handler) .event(FolderEvent::DeleteView, delete_view_handler) .event(FolderEvent::DuplicateView, duplicate_view_handler) .event(FolderEvent::SetLatestView, set_latest_view_handler) @@ -131,6 +132,9 @@ pub enum FolderEvent { #[event(input = "ViewId", output = "ViewInfo")] ReadViewInfo = 207, + #[event(input = "UpdateViewInfoPayload", output = "ViewInfo")] + UpdateViewInfo = 208, + #[event()] CopyLink = 220, diff --git a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs index cfacc23e0e..85efa862ef 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs @@ -54,6 +54,17 @@ pub(crate) async fn update_view_handler( Ok(()) } +#[tracing::instrument(level = "debug", skip(data, controller), err)] +pub(crate) async fn update_view_info_handler( + data: Data, + controller: AppData>, +) -> Result<(), FlowyError> { + let params: UpdateViewParams = data.into_inner().try_into()?; + let _ = controller.update_view(params).await?; + + Ok(()) +} + pub(crate) async fn delete_view_handler( data: Data, view_controller: AppData>, diff --git a/shared-lib/flowy-folder-data-model/src/entities/mod.rs b/shared-lib/flowy-folder-data-model/src/entities/mod.rs index 72ffbaebcf..ed6954739c 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/mod.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/mod.rs @@ -1,9 +1,11 @@ pub mod app; pub mod trash; pub mod view; +mod view_info; pub mod workspace; pub use app::*; pub use trash::*; pub use view::*; +pub use view_info::*; pub use workspace::*; diff --git a/shared-lib/flowy-folder-data-model/src/entities/view.rs b/shared-lib/flowy-folder-data-model/src/entities/view.rs index affe373caf..445aa6544a 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/view.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/view.rs @@ -8,7 +8,6 @@ use crate::{ }; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use nanoid::nanoid; - use serde_repr::*; use std::convert::TryInto; @@ -40,72 +39,6 @@ pub struct View { pub plugin_type: i32, } -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewInfo { - #[pb(index = 1)] - pub id: String, - - #[pb(index = 2)] - pub belong_to_id: String, - - #[pb(index = 3)] - pub name: String, - - #[pb(index = 4)] - pub desc: String, - - #[pb(index = 5)] - pub data_type: ViewDataType, - - #[pb(index = 6)] - pub belongings: RepeatedView, - - #[pb(index = 7)] - pub ext_data: ViewExtData, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewExtData { - #[pb(index = 1)] - pub filter: ViewFilter, - - #[pb(index = 2)] - pub group: ViewGroup, - - #[pb(index = 3)] - pub sort: ViewSort, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewFilter { - #[pb(index = 1)] - pub field_id: String, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewGroup { - #[pb(index = 1)] - pub group_field_id: String, - - #[pb(index = 2, one_of)] - pub sub_group_field_id: Option, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewSort { - #[pb(index = 1)] - pub field_id: String, -} - -#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)] -// #[serde(transparent)] -pub struct RepeatedView { - #[pb(index = 1)] - pub items: Vec, -} - -impl_def_and_def_mut!(RepeatedView, View); - #[derive(Eq, PartialEq, Hash, Debug, ProtoBuf_Enum, Clone, Serialize_repr, Deserialize_repr)] #[repr(u8)] pub enum ViewDataType { @@ -132,6 +65,20 @@ impl std::convert::From for ViewDataType { } } +#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)] +pub struct RepeatedView { + #[pb(index = 1)] + pub items: Vec, +} + +impl_def_and_def_mut!(RepeatedView, View); + +#[derive(Default, ProtoBuf)] +pub struct RepeatedViewId { + #[pb(index = 1)] + pub items: Vec, +} + #[derive(Default, ProtoBuf)] pub struct CreateViewPayload { #[pb(index = 1)] @@ -230,12 +177,6 @@ impl std::ops::Deref for ViewId { } } -#[derive(Default, ProtoBuf)] -pub struct RepeatedViewId { - #[pb(index = 1)] - pub items: Vec, -} - #[derive(Default, ProtoBuf)] pub struct UpdateViewPayload { #[pb(index = 1)] @@ -266,25 +207,6 @@ pub struct UpdateViewParams { pub thumbnail: Option, } -impl UpdateViewParams { - pub fn new(view_id: &str) -> Self { - Self { - view_id: view_id.to_owned(), - ..Default::default() - } - } - - pub fn name(mut self, name: &str) -> Self { - self.name = Some(name.to_owned()); - self - } - - pub fn desc(mut self, desc: &str) -> Self { - self.desc = Some(desc.to_owned()); - self - } -} - impl TryInto for UpdateViewPayload { type Error = ErrorCode; diff --git a/shared-lib/flowy-folder-data-model/src/entities/view_info.rs b/shared-lib/flowy-folder-data-model/src/entities/view_info.rs new file mode 100644 index 0000000000..7cb598e534 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/entities/view_info.rs @@ -0,0 +1,84 @@ +use crate::entities::{RepeatedView, ViewDataType}; +use crate::parser::view::ViewIdentify; +use flowy_derive::ProtoBuf; +use flowy_error_code::ErrorCode; +use std::convert::TryInto; + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewInfo { + #[pb(index = 1)] + pub id: String, + + #[pb(index = 2)] + pub belong_to_id: String, + + #[pb(index = 3)] + pub name: String, + + #[pb(index = 4)] + pub desc: String, + + #[pb(index = 5)] + pub data_type: ViewDataType, + + #[pb(index = 6)] + pub belongings: RepeatedView, + + #[pb(index = 7)] + pub ext_data: ViewExtData, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewExtData { + #[pb(index = 1)] + pub filter: ViewFilter, + + #[pb(index = 2)] + pub group: ViewGroup, + + #[pb(index = 3)] + pub sort: ViewSort, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewFilter { + #[pb(index = 1)] + pub field_id: String, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewGroup { + #[pb(index = 1)] + pub group_field_id: String, + + #[pb(index = 2, one_of)] + pub sub_group_field_id: Option, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewSort { + #[pb(index = 1)] + pub field_id: String, +} + +#[derive(Default, ProtoBuf)] +pub struct UpdateViewInfoPayload { + #[pb(index = 1)] + pub view_id: String, + + #[pb(index = 2, one_of)] + pub filter: Option, + + #[pb(index = 3, one_of)] + pub group: Option, + + #[pb(index = 4, one_of)] + pub sort: Option, +} + +pub struct UpdateViewInfoParams { + pub view_id: String, + pub filter: Option, + pub group: Option, + pub sort: Option, +} diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/model/mod.rs b/shared-lib/flowy-folder-data-model/src/protobuf/model/mod.rs index d12cb83589..64debcc99c 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/model/mod.rs +++ b/shared-lib/flowy-folder-data-model/src/protobuf/model/mod.rs @@ -4,6 +4,9 @@ mod app; pub use app::*; +mod view_info; +pub use view_info::*; + mod view; pub use view::*; diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs b/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs index 2954cfa693..3730b36759 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs +++ b/shared-lib/flowy-folder-data-model/src/protobuf/model/view.rs @@ -402,1283 +402,6 @@ impl ::protobuf::reflect::ProtobufValue for View { } } -#[derive(PartialEq,Clone,Default)] -pub struct ViewInfo { - // message fields - pub id: ::std::string::String, - pub belong_to_id: ::std::string::String, - pub name: ::std::string::String, - pub desc: ::std::string::String, - pub data_type: ViewDataType, - pub belongings: ::protobuf::SingularPtrField, - pub ext_data: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewInfo { - fn default() -> &'a ViewInfo { - ::default_instance() - } -} - -impl ViewInfo { - pub fn new() -> ViewInfo { - ::std::default::Default::default() - } - - // string id = 1; - - - pub fn get_id(&self) -> &str { - &self.id - } - pub fn clear_id(&mut self) { - self.id.clear(); - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::string::String) { - self.id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::string::String { - &mut self.id - } - - // Take field - pub fn take_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.id, ::std::string::String::new()) - } - - // string belong_to_id = 2; - - - pub fn get_belong_to_id(&self) -> &str { - &self.belong_to_id - } - pub fn clear_belong_to_id(&mut self) { - self.belong_to_id.clear(); - } - - // Param is passed by value, moved - pub fn set_belong_to_id(&mut self, v: ::std::string::String) { - self.belong_to_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_belong_to_id(&mut self) -> &mut ::std::string::String { - &mut self.belong_to_id - } - - // Take field - pub fn take_belong_to_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.belong_to_id, ::std::string::String::new()) - } - - // string name = 3; - - - pub fn get_name(&self) -> &str { - &self.name - } - pub fn clear_name(&mut self) { - self.name.clear(); - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - &mut self.name - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.name, ::std::string::String::new()) - } - - // string desc = 4; - - - pub fn get_desc(&self) -> &str { - &self.desc - } - pub fn clear_desc(&mut self) { - self.desc.clear(); - } - - // Param is passed by value, moved - pub fn set_desc(&mut self, v: ::std::string::String) { - self.desc = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_desc(&mut self) -> &mut ::std::string::String { - &mut self.desc - } - - // Take field - pub fn take_desc(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.desc, ::std::string::String::new()) - } - - // .ViewDataType data_type = 5; - - - pub fn get_data_type(&self) -> ViewDataType { - self.data_type - } - pub fn clear_data_type(&mut self) { - self.data_type = ViewDataType::TextBlock; - } - - // Param is passed by value, moved - pub fn set_data_type(&mut self, v: ViewDataType) { - self.data_type = v; - } - - // .RepeatedView belongings = 6; - - - pub fn get_belongings(&self) -> &RepeatedView { - self.belongings.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_belongings(&mut self) { - self.belongings.clear(); - } - - pub fn has_belongings(&self) -> bool { - self.belongings.is_some() - } - - // Param is passed by value, moved - pub fn set_belongings(&mut self, v: RepeatedView) { - self.belongings = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_belongings(&mut self) -> &mut RepeatedView { - if self.belongings.is_none() { - self.belongings.set_default(); - } - self.belongings.as_mut().unwrap() - } - - // Take field - pub fn take_belongings(&mut self) -> RepeatedView { - self.belongings.take().unwrap_or_else(|| RepeatedView::new()) - } - - // .ViewExtData ext_data = 7; - - - pub fn get_ext_data(&self) -> &ViewExtData { - self.ext_data.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_ext_data(&mut self) { - self.ext_data.clear(); - } - - pub fn has_ext_data(&self) -> bool { - self.ext_data.is_some() - } - - // Param is passed by value, moved - pub fn set_ext_data(&mut self, v: ViewExtData) { - self.ext_data = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_ext_data(&mut self) -> &mut ViewExtData { - if self.ext_data.is_none() { - self.ext_data.set_default(); - } - self.ext_data.as_mut().unwrap() - } - - // Take field - pub fn take_ext_data(&mut self) -> ViewExtData { - self.ext_data.take().unwrap_or_else(|| ViewExtData::new()) - } -} - -impl ::protobuf::Message for ViewInfo { - fn is_initialized(&self) -> bool { - for v in &self.belongings { - if !v.is_initialized() { - return false; - } - }; - for v in &self.ext_data { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.belong_to_id)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; - }, - 4 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.desc)?; - }, - 5 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.data_type, 5, &mut self.unknown_fields)? - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.belongings)?; - }, - 7 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.ext_data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.id); - } - if !self.belong_to_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.belong_to_id); - } - if !self.name.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.name); - } - if !self.desc.is_empty() { - my_size += ::protobuf::rt::string_size(4, &self.desc); - } - if self.data_type != ViewDataType::TextBlock { - my_size += ::protobuf::rt::enum_size(5, self.data_type); - } - if let Some(ref v) = self.belongings.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.ext_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.id.is_empty() { - os.write_string(1, &self.id)?; - } - if !self.belong_to_id.is_empty() { - os.write_string(2, &self.belong_to_id)?; - } - if !self.name.is_empty() { - os.write_string(3, &self.name)?; - } - if !self.desc.is_empty() { - os.write_string(4, &self.desc)?; - } - if self.data_type != ViewDataType::TextBlock { - os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.data_type))?; - } - if let Some(ref v) = self.belongings.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.ext_data.as_ref() { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewInfo { - ViewInfo::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "id", - |m: &ViewInfo| { &m.id }, - |m: &mut ViewInfo| { &mut m.id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "belong_to_id", - |m: &ViewInfo| { &m.belong_to_id }, - |m: &mut ViewInfo| { &mut m.belong_to_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - |m: &ViewInfo| { &m.name }, - |m: &mut ViewInfo| { &mut m.name }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "desc", - |m: &ViewInfo| { &m.desc }, - |m: &mut ViewInfo| { &mut m.desc }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "data_type", - |m: &ViewInfo| { &m.data_type }, - |m: &mut ViewInfo| { &mut m.data_type }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "belongings", - |m: &ViewInfo| { &m.belongings }, - |m: &mut ViewInfo| { &mut m.belongings }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "ext_data", - |m: &ViewInfo| { &m.ext_data }, - |m: &mut ViewInfo| { &mut m.ext_data }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewInfo", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewInfo { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewInfo::new) - } -} - -impl ::protobuf::Clear for ViewInfo { - fn clear(&mut self) { - self.id.clear(); - self.belong_to_id.clear(); - self.name.clear(); - self.desc.clear(); - self.data_type = ViewDataType::TextBlock; - self.belongings.clear(); - self.ext_data.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewInfo { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ViewExtData { - // message fields - pub filter: ::protobuf::SingularPtrField, - pub group: ::protobuf::SingularPtrField, - pub sort: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewExtData { - fn default() -> &'a ViewExtData { - ::default_instance() - } -} - -impl ViewExtData { - pub fn new() -> ViewExtData { - ::std::default::Default::default() - } - - // .ViewFilter filter = 1; - - - pub fn get_filter(&self) -> &ViewFilter { - self.filter.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_filter(&mut self) { - self.filter.clear(); - } - - pub fn has_filter(&self) -> bool { - self.filter.is_some() - } - - // Param is passed by value, moved - pub fn set_filter(&mut self, v: ViewFilter) { - self.filter = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_filter(&mut self) -> &mut ViewFilter { - if self.filter.is_none() { - self.filter.set_default(); - } - self.filter.as_mut().unwrap() - } - - // Take field - pub fn take_filter(&mut self) -> ViewFilter { - self.filter.take().unwrap_or_else(|| ViewFilter::new()) - } - - // .ViewGroup group = 2; - - - pub fn get_group(&self) -> &ViewGroup { - self.group.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_group(&mut self) { - self.group.clear(); - } - - pub fn has_group(&self) -> bool { - self.group.is_some() - } - - // Param is passed by value, moved - pub fn set_group(&mut self, v: ViewGroup) { - self.group = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_group(&mut self) -> &mut ViewGroup { - if self.group.is_none() { - self.group.set_default(); - } - self.group.as_mut().unwrap() - } - - // Take field - pub fn take_group(&mut self) -> ViewGroup { - self.group.take().unwrap_or_else(|| ViewGroup::new()) - } - - // .ViewSort sort = 3; - - - pub fn get_sort(&self) -> &ViewSort { - self.sort.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_sort(&mut self) { - self.sort.clear(); - } - - pub fn has_sort(&self) -> bool { - self.sort.is_some() - } - - // Param is passed by value, moved - pub fn set_sort(&mut self, v: ViewSort) { - self.sort = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sort(&mut self) -> &mut ViewSort { - if self.sort.is_none() { - self.sort.set_default(); - } - self.sort.as_mut().unwrap() - } - - // Take field - pub fn take_sort(&mut self) -> ViewSort { - self.sort.take().unwrap_or_else(|| ViewSort::new()) - } -} - -impl ::protobuf::Message for ViewExtData { - fn is_initialized(&self) -> bool { - for v in &self.filter { - if !v.is_initialized() { - return false; - } - }; - for v in &self.group { - if !v.is_initialized() { - return false; - } - }; - for v in &self.sort { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.filter)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.group)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.sort)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.filter.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.group.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.sort.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.filter.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.group.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.sort.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewExtData { - ViewExtData::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "filter", - |m: &ViewExtData| { &m.filter }, - |m: &mut ViewExtData| { &mut m.filter }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "group", - |m: &ViewExtData| { &m.group }, - |m: &mut ViewExtData| { &mut m.group }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "sort", - |m: &ViewExtData| { &m.sort }, - |m: &mut ViewExtData| { &mut m.sort }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewExtData", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewExtData { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewExtData::new) - } -} - -impl ::protobuf::Clear for ViewExtData { - fn clear(&mut self) { - self.filter.clear(); - self.group.clear(); - self.sort.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewExtData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewExtData { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ViewFilter { - // message fields - pub field_id: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewFilter { - fn default() -> &'a ViewFilter { - ::default_instance() - } -} - -impl ViewFilter { - pub fn new() -> ViewFilter { - ::std::default::Default::default() - } - - // string field_id = 1; - - - pub fn get_field_id(&self) -> &str { - &self.field_id - } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); - } - - // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id - } - - // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) - } -} - -impl ::protobuf::Message for ViewFilter { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.field_id); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.field_id.is_empty() { - os.write_string(1, &self.field_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewFilter { - ViewFilter::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &ViewFilter| { &m.field_id }, - |m: &mut ViewFilter| { &mut m.field_id }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewFilter", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewFilter { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewFilter::new) - } -} - -impl ::protobuf::Clear for ViewFilter { - fn clear(&mut self) { - self.field_id.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewFilter { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewFilter { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ViewGroup { - // message fields - pub group_field_id: ::std::string::String, - // message oneof groups - pub one_of_sub_group_field_id: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewGroup { - fn default() -> &'a ViewGroup { - ::default_instance() - } -} - -#[derive(Clone,PartialEq,Debug)] -pub enum ViewGroup_oneof_one_of_sub_group_field_id { - sub_group_field_id(::std::string::String), -} - -impl ViewGroup { - pub fn new() -> ViewGroup { - ::std::default::Default::default() - } - - // string group_field_id = 1; - - - pub fn get_group_field_id(&self) -> &str { - &self.group_field_id - } - pub fn clear_group_field_id(&mut self) { - self.group_field_id.clear(); - } - - // Param is passed by value, moved - pub fn set_group_field_id(&mut self, v: ::std::string::String) { - self.group_field_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_group_field_id(&mut self) -> &mut ::std::string::String { - &mut self.group_field_id - } - - // Take field - pub fn take_group_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.group_field_id, ::std::string::String::new()) - } - - // string sub_group_field_id = 2; - - - pub fn get_sub_group_field_id(&self) -> &str { - match self.one_of_sub_group_field_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v)) => v, - _ => "", - } - } - pub fn clear_sub_group_field_id(&mut self) { - self.one_of_sub_group_field_id = ::std::option::Option::None; - } - - pub fn has_sub_group_field_id(&self) -> bool { - match self.one_of_sub_group_field_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_sub_group_field_id(&mut self, v: ::std::string::String) { - self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) - } - - // Mutable pointer to the field. - pub fn mut_sub_group_field_id(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(_)) = self.one_of_sub_group_field_id { - } else { - self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(::std::string::String::new())); - } - match self.one_of_sub_group_field_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_sub_group_field_id(&mut self) -> ::std::string::String { - if self.has_sub_group_field_id() { - match self.one_of_sub_group_field_id.take() { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } -} - -impl ::protobuf::Message for ViewGroup { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.group_field_id)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(is.read_string()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.group_field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.group_field_id); - } - if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { - match v { - &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { - my_size += ::protobuf::rt::string_size(2, &v); - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.group_field_id.is_empty() { - os.write_string(1, &self.group_field_id)?; - } - if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { - match v { - &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { - os.write_string(2, v)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewGroup { - ViewGroup::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "group_field_id", - |m: &ViewGroup| { &m.group_field_id }, - |m: &mut ViewGroup| { &mut m.group_field_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "sub_group_field_id", - ViewGroup::has_sub_group_field_id, - ViewGroup::get_sub_group_field_id, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewGroup", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewGroup { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewGroup::new) - } -} - -impl ::protobuf::Clear for ViewGroup { - fn clear(&mut self) { - self.group_field_id.clear(); - self.one_of_sub_group_field_id = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewGroup { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewGroup { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ViewSort { - // message fields - pub field_id: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewSort { - fn default() -> &'a ViewSort { - ::default_instance() - } -} - -impl ViewSort { - pub fn new() -> ViewSort { - ::std::default::Default::default() - } - - // string field_id = 1; - - - pub fn get_field_id(&self) -> &str { - &self.field_id - } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); - } - - // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id - } - - // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) - } -} - -impl ::protobuf::Message for ViewSort { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.field_id); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.field_id.is_empty() { - os.write_string(1, &self.field_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewSort { - ViewSort::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &ViewSort| { &m.field_id }, - |m: &mut ViewSort| { &mut m.field_id }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewSort", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewSort { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewSort::new) - } -} - -impl ::protobuf::Clear for ViewSort { - fn clear(&mut self) { - self.field_id.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewSort { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewSort { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - #[derive(PartialEq,Clone,Default)] pub struct RepeatedView { // message fields @@ -1845,6 +568,164 @@ impl ::protobuf::reflect::ProtobufValue for RepeatedView { } } +#[derive(PartialEq,Clone,Default)] +pub struct RepeatedViewId { + // message fields + pub items: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a RepeatedViewId { + fn default() -> &'a RepeatedViewId { + ::default_instance() + } +} + +impl RepeatedViewId { + pub fn new() -> RepeatedViewId { + ::std::default::Default::default() + } + + // repeated string items = 1; + + + pub fn get_items(&self) -> &[::std::string::String] { + &self.items + } + pub fn clear_items(&mut self) { + self.items.clear(); + } + + // Param is passed by value, moved + pub fn set_items(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.items = v; + } + + // Mutable pointer to the field. + pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.items + } + + // Take field + pub fn take_items(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for RepeatedViewId { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.items)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.items { + my_size += ::protobuf::rt::string_size(1, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.items { + os.write_string(1, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> RepeatedViewId { + RepeatedViewId::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "items", + |m: &RepeatedViewId| { &m.items }, + |m: &mut RepeatedViewId| { &mut m.items }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "RepeatedViewId", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static RepeatedViewId { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(RepeatedViewId::new) + } +} + +impl ::protobuf::Clear for RepeatedViewId { + fn clear(&mut self) { + self.items.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RepeatedViewId { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RepeatedViewId { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + #[derive(PartialEq,Clone,Default)] pub struct CreateViewPayload { // message fields @@ -2872,164 +1753,6 @@ impl ::protobuf::reflect::ProtobufValue for ViewId { } } -#[derive(PartialEq,Clone,Default)] -pub struct RepeatedViewId { - // message fields - pub items: ::protobuf::RepeatedField<::std::string::String>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a RepeatedViewId { - fn default() -> &'a RepeatedViewId { - ::default_instance() - } -} - -impl RepeatedViewId { - pub fn new() -> RepeatedViewId { - ::std::default::Default::default() - } - - // repeated string items = 1; - - - pub fn get_items(&self) -> &[::std::string::String] { - &self.items - } - pub fn clear_items(&mut self) { - self.items.clear(); - } - - // Param is passed by value, moved - pub fn set_items(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { - self.items = v; - } - - // Mutable pointer to the field. - pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.items - } - - // Take field - pub fn take_items(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { - ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) - } -} - -impl ::protobuf::Message for RepeatedViewId { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.items)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - for value in &self.items { - my_size += ::protobuf::rt::string_size(1, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - for v in &self.items { - os.write_string(1, &v)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RepeatedViewId { - RepeatedViewId::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "items", - |m: &RepeatedViewId| { &m.items }, - |m: &mut RepeatedViewId| { &mut m.items }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "RepeatedViewId", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static RepeatedViewId { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(RepeatedViewId::new) - } -} - -impl ::protobuf::Clear for RepeatedViewId { - fn clear(&mut self) { - self.items.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RepeatedViewId { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RepeatedViewId { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - #[derive(PartialEq,Clone,Default)] pub struct UpdateViewPayload { // message fields @@ -4202,51 +2925,38 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \n\x04name\x18\x03\x20\x01(\tR\x04name\x12*\n\tdata_type\x18\x04\x20\x01\ (\x0e2\r.ViewDataTypeR\x08dataType\x12#\n\rmodified_time\x18\x05\x20\x01\ (\x03R\x0cmodifiedTime\x12\x1f\n\x0bcreate_time\x18\x06\x20\x01(\x03R\nc\ - reateTime\x12\x1f\n\x0bplugin_type\x18\x07\x20\x01(\x05R\npluginType\"\ - \xe8\x01\n\x08ViewInfo\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x20\ - \n\x0cbelong_to_id\x18\x02\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\ - \x03\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x04\x20\x01(\tR\x04desc\ - \x12*\n\tdata_type\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08dataType\x12\ - -\n\nbelongings\x18\x06\x20\x01(\x0b2\r.RepeatedViewR\nbelongings\x12'\n\ - \x08ext_data\x18\x07\x20\x01(\x0b2\x0c.ViewExtDataR\x07extData\"s\n\x0bV\ - iewExtData\x12#\n\x06filter\x18\x01\x20\x01(\x0b2\x0b.ViewFilterR\x06fil\ - ter\x12\x20\n\x05group\x18\x02\x20\x01(\x0b2\n.ViewGroupR\x05group\x12\ - \x1d\n\x04sort\x18\x03\x20\x01(\x0b2\t.ViewSortR\x04sort\"'\n\nViewFilte\ - r\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\"}\n\tViewGroup\ - \x12$\n\x0egroup_field_id\x18\x01\x20\x01(\tR\x0cgroupFieldId\x12-\n\x12\ - sub_group_field_id\x18\x02\x20\x01(\tH\0R\x0fsubGroupFieldIdB\x1b\n\x19o\ - ne_of_sub_group_field_id\"%\n\x08ViewSort\x12\x19\n\x08field_id\x18\x01\ - \x20\x01(\tR\x07fieldId\"+\n\x0cRepeatedView\x12\x1b\n\x05items\x18\x01\ - \x20\x03(\x0b2\x05.ViewR\x05items\"\xf2\x01\n\x11CreateViewPayload\x12\ - \x20\n\x0cbelong_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\ - \x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04de\ - sc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\0R\tthumbnail\x12*\n\tdata_t\ - ype\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08dataType\x12\x1f\n\x0bplugi\ - n_type\x18\x06\x20\x01(\x05R\npluginType\x12\x12\n\x04data\x18\x07\x20\ - \x01(\x0cR\x04dataB\x12\n\x10one_of_thumbnail\"\xf4\x01\n\x10CreateViewP\ - arams\x12\x20\n\x0cbelong_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\ - \n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01\ - (\tR\x04desc\x12\x1c\n\tthumbnail\x18\x04\x20\x01(\tR\tthumbnail\x12*\n\ - \tdata_type\x18\x05\x20\x01(\x0e2\r.ViewDataTypeR\x08dataType\x12\x17\n\ - \x07view_id\x18\x06\x20\x01(\tR\x06viewId\x12\x12\n\x04data\x18\x07\x20\ - \x01(\x0cR\x04data\x12\x1f\n\x0bplugin_type\x18\x08\x20\x01(\x05R\nplugi\ - nType\"\x1e\n\x06ViewId\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value\ - \"&\n\x0eRepeatedViewId\x12\x14\n\x05items\x18\x01\x20\x03(\tR\x05items\ - \"\xaa\x01\n\x11UpdateViewPayload\x12\x17\n\x07view_id\x18\x01\x20\x01(\ - \tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\x01(\tH\0R\x04name\x12\x14\n\ - \x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12\x1e\n\tthumbnail\x18\x04\ - \x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of_nameB\r\n\x0bone_of_descB\ - \x12\n\x10one_of_thumbnail\"\xa9\x01\n\x10UpdateViewParams\x12\x17\n\x07\ - view_id\x18\x01\x20\x01(\tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\x01(\ - \tH\0R\x04name\x12\x14\n\x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12\ - \x1e\n\tthumbnail\x18\x04\x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of_nam\ - eB\r\n\x0bone_of_descB\x12\n\x10one_of_thumbnail\"y\n\x15MoveFolderItemP\ - ayload\x12\x17\n\x07item_id\x18\x01\x20\x01(\tR\x06itemId\x12\x12\n\x04f\ - rom\x18\x02\x20\x01(\x05R\x04from\x12\x0e\n\x02to\x18\x03\x20\x01(\x05R\ - \x02to\x12#\n\x02ty\x18\x04\x20\x01(\x0e2\x13.MoveFolderItemTypeR\x02ty*\ - '\n\x0cViewDataType\x12\r\n\tTextBlock\x10\0\x12\x08\n\x04Grid\x10\x01*/\ - \n\x12MoveFolderItemType\x12\x0b\n\x07MoveApp\x10\0\x12\x0c\n\x08MoveVie\ - w\x10\x01b\x06proto3\ + reateTime\x12\x1f\n\x0bplugin_type\x18\x07\x20\x01(\x05R\npluginType\"+\ + \n\x0cRepeatedView\x12\x1b\n\x05items\x18\x01\x20\x03(\x0b2\x05.ViewR\ + \x05items\"&\n\x0eRepeatedViewId\x12\x14\n\x05items\x18\x01\x20\x03(\tR\ + \x05items\"\xf2\x01\n\x11CreateViewPayload\x12\x20\n\x0cbelong_to_id\x18\ + \x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04na\ + me\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12\x1e\n\tthumbnail\ + \x18\x04\x20\x01(\tH\0R\tthumbnail\x12*\n\tdata_type\x18\x05\x20\x01(\ + \x0e2\r.ViewDataTypeR\x08dataType\x12\x1f\n\x0bplugin_type\x18\x06\x20\ + \x01(\x05R\npluginType\x12\x12\n\x04data\x18\x07\x20\x01(\x0cR\x04dataB\ + \x12\n\x10one_of_thumbnail\"\xf4\x01\n\x10CreateViewParams\x12\x20\n\x0c\ + belong_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x02\ + \x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12\ + \x1c\n\tthumbnail\x18\x04\x20\x01(\tR\tthumbnail\x12*\n\tdata_type\x18\ + \x05\x20\x01(\x0e2\r.ViewDataTypeR\x08dataType\x12\x17\n\x07view_id\x18\ + \x06\x20\x01(\tR\x06viewId\x12\x12\n\x04data\x18\x07\x20\x01(\x0cR\x04da\ + ta\x12\x1f\n\x0bplugin_type\x18\x08\x20\x01(\x05R\npluginType\"\x1e\n\ + \x06ViewId\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value\"\xaa\x01\n\ + \x11UpdateViewPayload\x12\x17\n\x07view_id\x18\x01\x20\x01(\tR\x06viewId\ + \x12\x14\n\x04name\x18\x02\x20\x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\ + \x03\x20\x01(\tH\x01R\x04desc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\ + \x02R\tthumbnailB\r\n\x0bone_of_nameB\r\n\x0bone_of_descB\x12\n\x10one_o\ + f_thumbnail\"\xa9\x01\n\x10UpdateViewParams\x12\x17\n\x07view_id\x18\x01\ + \x20\x01(\tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\x01(\tH\0R\x04name\ + \x12\x14\n\x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12\x1e\n\tthumbnail\ + \x18\x04\x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of_nameB\r\n\x0bone_of_\ + descB\x12\n\x10one_of_thumbnail\"y\n\x15MoveFolderItemPayload\x12\x17\n\ + \x07item_id\x18\x01\x20\x01(\tR\x06itemId\x12\x12\n\x04from\x18\x02\x20\ + \x01(\x05R\x04from\x12\x0e\n\x02to\x18\x03\x20\x01(\x05R\x02to\x12#\n\ + \x02ty\x18\x04\x20\x01(\x0e2\x13.MoveFolderItemTypeR\x02ty*'\n\x0cViewDa\ + taType\x12\r\n\tTextBlock\x10\0\x12\x08\n\x04Grid\x10\x01*/\n\x12MoveFol\ + derItemType\x12\x0b\n\x07MoveApp\x10\0\x12\x0c\n\x08MoveView\x10\x01b\ + \x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs b/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs new file mode 100644 index 0000000000..e6e022ffd2 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs @@ -0,0 +1,1331 @@ +// This file is generated by rust-protobuf 2.25.2. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `view_info.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2; + +#[derive(PartialEq,Clone,Default)] +pub struct ViewInfo { + // message fields + pub id: ::std::string::String, + pub belong_to_id: ::std::string::String, + pub name: ::std::string::String, + pub desc: ::std::string::String, + pub data_type: super::view::ViewDataType, + pub belongings: ::protobuf::SingularPtrField, + pub ext_data: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewInfo { + fn default() -> &'a ViewInfo { + ::default_instance() + } +} + +impl ViewInfo { + pub fn new() -> ViewInfo { + ::std::default::Default::default() + } + + // string id = 1; + + + pub fn get_id(&self) -> &str { + &self.id + } + pub fn clear_id(&mut self) { + self.id.clear(); + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::string::String) { + self.id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::string::String { + &mut self.id + } + + // Take field + pub fn take_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.id, ::std::string::String::new()) + } + + // string belong_to_id = 2; + + + pub fn get_belong_to_id(&self) -> &str { + &self.belong_to_id + } + pub fn clear_belong_to_id(&mut self) { + self.belong_to_id.clear(); + } + + // Param is passed by value, moved + pub fn set_belong_to_id(&mut self, v: ::std::string::String) { + self.belong_to_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_belong_to_id(&mut self) -> &mut ::std::string::String { + &mut self.belong_to_id + } + + // Take field + pub fn take_belong_to_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.belong_to_id, ::std::string::String::new()) + } + + // string name = 3; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // string desc = 4; + + + pub fn get_desc(&self) -> &str { + &self.desc + } + pub fn clear_desc(&mut self) { + self.desc.clear(); + } + + // Param is passed by value, moved + pub fn set_desc(&mut self, v: ::std::string::String) { + self.desc = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_desc(&mut self) -> &mut ::std::string::String { + &mut self.desc + } + + // Take field + pub fn take_desc(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.desc, ::std::string::String::new()) + } + + // .ViewDataType data_type = 5; + + + pub fn get_data_type(&self) -> super::view::ViewDataType { + self.data_type + } + pub fn clear_data_type(&mut self) { + self.data_type = super::view::ViewDataType::TextBlock; + } + + // Param is passed by value, moved + pub fn set_data_type(&mut self, v: super::view::ViewDataType) { + self.data_type = v; + } + + // .RepeatedView belongings = 6; + + + pub fn get_belongings(&self) -> &super::view::RepeatedView { + self.belongings.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_belongings(&mut self) { + self.belongings.clear(); + } + + pub fn has_belongings(&self) -> bool { + self.belongings.is_some() + } + + // Param is passed by value, moved + pub fn set_belongings(&mut self, v: super::view::RepeatedView) { + self.belongings = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_belongings(&mut self) -> &mut super::view::RepeatedView { + if self.belongings.is_none() { + self.belongings.set_default(); + } + self.belongings.as_mut().unwrap() + } + + // Take field + pub fn take_belongings(&mut self) -> super::view::RepeatedView { + self.belongings.take().unwrap_or_else(|| super::view::RepeatedView::new()) + } + + // .ViewExtData ext_data = 7; + + + pub fn get_ext_data(&self) -> &ViewExtData { + self.ext_data.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_ext_data(&mut self) { + self.ext_data.clear(); + } + + pub fn has_ext_data(&self) -> bool { + self.ext_data.is_some() + } + + // Param is passed by value, moved + pub fn set_ext_data(&mut self, v: ViewExtData) { + self.ext_data = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ext_data(&mut self) -> &mut ViewExtData { + if self.ext_data.is_none() { + self.ext_data.set_default(); + } + self.ext_data.as_mut().unwrap() + } + + // Take field + pub fn take_ext_data(&mut self) -> ViewExtData { + self.ext_data.take().unwrap_or_else(|| ViewExtData::new()) + } +} + +impl ::protobuf::Message for ViewInfo { + fn is_initialized(&self) -> bool { + for v in &self.belongings { + if !v.is_initialized() { + return false; + } + }; + for v in &self.ext_data { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.belong_to_id)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.desc)?; + }, + 5 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.data_type, 5, &mut self.unknown_fields)? + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.belongings)?; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.ext_data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.id); + } + if !self.belong_to_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.belong_to_id); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.name); + } + if !self.desc.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.desc); + } + if self.data_type != super::view::ViewDataType::TextBlock { + my_size += ::protobuf::rt::enum_size(5, self.data_type); + } + if let Some(ref v) = self.belongings.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.ext_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.id.is_empty() { + os.write_string(1, &self.id)?; + } + if !self.belong_to_id.is_empty() { + os.write_string(2, &self.belong_to_id)?; + } + if !self.name.is_empty() { + os.write_string(3, &self.name)?; + } + if !self.desc.is_empty() { + os.write_string(4, &self.desc)?; + } + if self.data_type != super::view::ViewDataType::TextBlock { + os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.data_type))?; + } + if let Some(ref v) = self.belongings.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.ext_data.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewInfo { + ViewInfo::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "id", + |m: &ViewInfo| { &m.id }, + |m: &mut ViewInfo| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "belong_to_id", + |m: &ViewInfo| { &m.belong_to_id }, + |m: &mut ViewInfo| { &mut m.belong_to_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &ViewInfo| { &m.name }, + |m: &mut ViewInfo| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "desc", + |m: &ViewInfo| { &m.desc }, + |m: &mut ViewInfo| { &mut m.desc }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "data_type", + |m: &ViewInfo| { &m.data_type }, + |m: &mut ViewInfo| { &mut m.data_type }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "belongings", + |m: &ViewInfo| { &m.belongings }, + |m: &mut ViewInfo| { &mut m.belongings }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "ext_data", + |m: &ViewInfo| { &m.ext_data }, + |m: &mut ViewInfo| { &mut m.ext_data }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewInfo", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewInfo { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewInfo::new) + } +} + +impl ::protobuf::Clear for ViewInfo { + fn clear(&mut self) { + self.id.clear(); + self.belong_to_id.clear(); + self.name.clear(); + self.desc.clear(); + self.data_type = super::view::ViewDataType::TextBlock; + self.belongings.clear(); + self.ext_data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewInfo { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewExtData { + // message fields + pub filter: ::protobuf::SingularPtrField, + pub group: ::protobuf::SingularPtrField, + pub sort: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewExtData { + fn default() -> &'a ViewExtData { + ::default_instance() + } +} + +impl ViewExtData { + pub fn new() -> ViewExtData { + ::std::default::Default::default() + } + + // .ViewFilter filter = 1; + + + pub fn get_filter(&self) -> &ViewFilter { + self.filter.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_filter(&mut self) { + self.filter.clear(); + } + + pub fn has_filter(&self) -> bool { + self.filter.is_some() + } + + // Param is passed by value, moved + pub fn set_filter(&mut self, v: ViewFilter) { + self.filter = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_filter(&mut self) -> &mut ViewFilter { + if self.filter.is_none() { + self.filter.set_default(); + } + self.filter.as_mut().unwrap() + } + + // Take field + pub fn take_filter(&mut self) -> ViewFilter { + self.filter.take().unwrap_or_else(|| ViewFilter::new()) + } + + // .ViewGroup group = 2; + + + pub fn get_group(&self) -> &ViewGroup { + self.group.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_group(&mut self) { + self.group.clear(); + } + + pub fn has_group(&self) -> bool { + self.group.is_some() + } + + // Param is passed by value, moved + pub fn set_group(&mut self, v: ViewGroup) { + self.group = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_group(&mut self) -> &mut ViewGroup { + if self.group.is_none() { + self.group.set_default(); + } + self.group.as_mut().unwrap() + } + + // Take field + pub fn take_group(&mut self) -> ViewGroup { + self.group.take().unwrap_or_else(|| ViewGroup::new()) + } + + // .ViewSort sort = 3; + + + pub fn get_sort(&self) -> &ViewSort { + self.sort.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_sort(&mut self) { + self.sort.clear(); + } + + pub fn has_sort(&self) -> bool { + self.sort.is_some() + } + + // Param is passed by value, moved + pub fn set_sort(&mut self, v: ViewSort) { + self.sort = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sort(&mut self) -> &mut ViewSort { + if self.sort.is_none() { + self.sort.set_default(); + } + self.sort.as_mut().unwrap() + } + + // Take field + pub fn take_sort(&mut self) -> ViewSort { + self.sort.take().unwrap_or_else(|| ViewSort::new()) + } +} + +impl ::protobuf::Message for ViewExtData { + fn is_initialized(&self) -> bool { + for v in &self.filter { + if !v.is_initialized() { + return false; + } + }; + for v in &self.group { + if !v.is_initialized() { + return false; + } + }; + for v in &self.sort { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.filter)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.group)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.sort)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.filter.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.group.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.sort.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.filter.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.group.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.sort.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewExtData { + ViewExtData::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "filter", + |m: &ViewExtData| { &m.filter }, + |m: &mut ViewExtData| { &mut m.filter }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "group", + |m: &ViewExtData| { &m.group }, + |m: &mut ViewExtData| { &mut m.group }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "sort", + |m: &ViewExtData| { &m.sort }, + |m: &mut ViewExtData| { &mut m.sort }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewExtData", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewExtData { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewExtData::new) + } +} + +impl ::protobuf::Clear for ViewExtData { + fn clear(&mut self) { + self.filter.clear(); + self.group.clear(); + self.sort.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewExtData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewExtData { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewFilter { + // message fields + pub field_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewFilter { + fn default() -> &'a ViewFilter { + ::default_instance() + } +} + +impl ViewFilter { + pub fn new() -> ViewFilter { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for ViewFilter { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.field_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.field_id.is_empty() { + os.write_string(1, &self.field_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewFilter { + ViewFilter::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &ViewFilter| { &m.field_id }, + |m: &mut ViewFilter| { &mut m.field_id }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewFilter", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewFilter { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewFilter::new) + } +} + +impl ::protobuf::Clear for ViewFilter { + fn clear(&mut self) { + self.field_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewFilter { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewFilter { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewGroup { + // message fields + pub group_field_id: ::std::string::String, + // message oneof groups + pub one_of_sub_group_field_id: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewGroup { + fn default() -> &'a ViewGroup { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum ViewGroup_oneof_one_of_sub_group_field_id { + sub_group_field_id(::std::string::String), +} + +impl ViewGroup { + pub fn new() -> ViewGroup { + ::std::default::Default::default() + } + + // string group_field_id = 1; + + + pub fn get_group_field_id(&self) -> &str { + &self.group_field_id + } + pub fn clear_group_field_id(&mut self) { + self.group_field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_group_field_id(&mut self, v: ::std::string::String) { + self.group_field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_group_field_id(&mut self) -> &mut ::std::string::String { + &mut self.group_field_id + } + + // Take field + pub fn take_group_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.group_field_id, ::std::string::String::new()) + } + + // string sub_group_field_id = 2; + + + pub fn get_sub_group_field_id(&self) -> &str { + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_sub_group_field_id(&mut self) { + self.one_of_sub_group_field_id = ::std::option::Option::None; + } + + pub fn has_sub_group_field_id(&self) -> bool { + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_sub_group_field_id(&mut self, v: ::std::string::String) { + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_sub_group_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(_)) = self.one_of_sub_group_field_id { + } else { + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(::std::string::String::new())); + } + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_sub_group_field_id(&mut self) -> ::std::string::String { + if self.has_sub_group_field_id() { + match self.one_of_sub_group_field_id.take() { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } +} + +impl ::protobuf::Message for ViewGroup { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.group_field_id)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(is.read_string()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.group_field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.group_field_id); + } + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + match v { + &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + my_size += ::protobuf::rt::string_size(2, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.group_field_id.is_empty() { + os.write_string(1, &self.group_field_id)?; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + match v { + &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + os.write_string(2, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewGroup { + ViewGroup::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "group_field_id", + |m: &ViewGroup| { &m.group_field_id }, + |m: &mut ViewGroup| { &mut m.group_field_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "sub_group_field_id", + ViewGroup::has_sub_group_field_id, + ViewGroup::get_sub_group_field_id, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewGroup", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewGroup { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewGroup::new) + } +} + +impl ::protobuf::Clear for ViewGroup { + fn clear(&mut self) { + self.group_field_id.clear(); + self.one_of_sub_group_field_id = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewGroup { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewGroup { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewSort { + // message fields + pub field_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewSort { + fn default() -> &'a ViewSort { + ::default_instance() + } +} + +impl ViewSort { + pub fn new() -> ViewSort { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for ViewSort { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.field_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.field_id.is_empty() { + os.write_string(1, &self.field_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewSort { + ViewSort::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &ViewSort| { &m.field_id }, + |m: &mut ViewSort| { &mut m.field_id }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewSort", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewSort { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewSort::new) + } +} + +impl ::protobuf::Clear for ViewSort { + fn clear(&mut self) { + self.field_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewSort { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewSort { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0fview_info.proto\x1a\nview.proto\"\xe8\x01\n\x08ViewInfo\x12\x0e\n\ + \x02id\x18\x01\x20\x01(\tR\x02id\x12\x20\n\x0cbelong_to_id\x18\x02\x20\ + \x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x03\x20\x01(\tR\x04name\x12\ + \x12\n\x04desc\x18\x04\x20\x01(\tR\x04desc\x12*\n\tdata_type\x18\x05\x20\ + \x01(\x0e2\r.ViewDataTypeR\x08dataType\x12-\n\nbelongings\x18\x06\x20\ + \x01(\x0b2\r.RepeatedViewR\nbelongings\x12'\n\x08ext_data\x18\x07\x20\ + \x01(\x0b2\x0c.ViewExtDataR\x07extData\"s\n\x0bViewExtData\x12#\n\x06fil\ + ter\x18\x01\x20\x01(\x0b2\x0b.ViewFilterR\x06filter\x12\x20\n\x05group\ + \x18\x02\x20\x01(\x0b2\n.ViewGroupR\x05group\x12\x1d\n\x04sort\x18\x03\ + \x20\x01(\x0b2\t.ViewSortR\x04sort\"'\n\nViewFilter\x12\x19\n\x08field_i\ + d\x18\x01\x20\x01(\tR\x07fieldId\"}\n\tViewGroup\x12$\n\x0egroup_field_i\ + d\x18\x01\x20\x01(\tR\x0cgroupFieldId\x12-\n\x12sub_group_field_id\x18\ + \x02\x20\x01(\tH\0R\x0fsubGroupFieldIdB\x1b\n\x19one_of_sub_group_field_\ + id\"%\n\x08ViewSort\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\ + b\x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto index 6009fb407c..1c0ec3cfdd 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto +++ b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view.proto @@ -9,33 +9,12 @@ message View { int64 create_time = 6; int32 plugin_type = 7; } -message ViewInfo { - string id = 1; - string belong_to_id = 2; - string name = 3; - string desc = 4; - ViewDataType data_type = 5; - RepeatedView belongings = 6; - ViewExtData ext_data = 7; -} -message ViewExtData { - ViewFilter filter = 1; - ViewGroup group = 2; - ViewSort sort = 3; -} -message ViewFilter { - string field_id = 1; -} -message ViewGroup { - string group_field_id = 1; - oneof one_of_sub_group_field_id { string sub_group_field_id = 2; }; -} -message ViewSort { - string field_id = 1; -} message RepeatedView { repeated View items = 1; } +message RepeatedViewId { + repeated string items = 1; +} message CreateViewPayload { string belong_to_id = 1; string name = 2; @@ -58,9 +37,6 @@ message CreateViewParams { message ViewId { string value = 1; } -message RepeatedViewId { - repeated string items = 1; -} message UpdateViewPayload { string view_id = 1; oneof one_of_name { string name = 2; }; diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto new file mode 100644 index 0000000000..2f85dd1b7c --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +import "view.proto"; + +message ViewInfo { + string id = 1; + string belong_to_id = 2; + string name = 3; + string desc = 4; + ViewDataType data_type = 5; + RepeatedView belongings = 6; + ViewExtData ext_data = 7; +} +message ViewExtData { + ViewFilter filter = 1; + ViewGroup group = 2; + ViewSort sort = 3; +} +message ViewFilter { + string field_id = 1; +} +message ViewGroup { + string group_field_id = 1; + oneof one_of_sub_group_field_id { string sub_group_field_id = 2; }; +} +message ViewSort { + string field_id = 1; +} From 50605186fe0047fe66718bbaf4c87f7e8a7a5101 Mon Sep 17 00:00:00 2001 From: appflowy Date: Wed, 15 Jun 2022 11:43:24 +0800 Subject: [PATCH 09/11] chore: update view info --- .../rust-lib/flowy-folder/src/event_map.rs | 4 ++ frontend/rust-lib/flowy-folder/src/manager.rs | 12 +++++- .../src/services/view/controller.rs | 28 +++++++++++-- .../src/services/view/event_handler.rs | 8 ++-- frontend/rust-lib/flowy-grid/src/manager.rs | 2 + .../flowy-sdk/src/deps_resolve/folder_deps.rs | 23 +++++++++-- shared-lib/flowy-error-code/src/code.rs | 3 ++ .../src/entities/view_info.rs | 39 ++++++++++++++++-- .../flowy-folder-data-model/src/parser/mod.rs | 1 + .../src/parser/view_info/mod.rs | 5 +++ .../src/parser/view_info/object_id.rs | 19 +++++++++ .../src/parser/view_info/view_ext.rs | 40 +++++++++++++++++++ .../src/revision/view.rs | 12 ++++-- 13 files changed, 175 insertions(+), 21 deletions(-) create mode 100644 shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs create mode 100644 shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs create mode 100644 shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs diff --git a/frontend/rust-lib/flowy-folder/src/event_map.rs b/frontend/rust-lib/flowy-folder/src/event_map.rs index b1a0b186a3..8caf43c9c0 100644 --- a/frontend/rust-lib/flowy-folder/src/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/event_map.rs @@ -43,6 +43,7 @@ pub fn create(folder: Arc) -> Module { .data(folder.trash_controller.clone()) .data(folder.clone()); + // Workspace module = module .event(FolderEvent::CreateWorkspace, create_workspace_handler) .event(FolderEvent::ReadCurWorkspace, read_cur_workspace_handler) @@ -50,12 +51,14 @@ pub fn create(folder: Arc) -> Module { .event(FolderEvent::OpenWorkspace, open_workspace_handler) .event(FolderEvent::ReadWorkspaceApps, read_workspace_apps_handler); + // App module = module .event(FolderEvent::CreateApp, create_app_handler) .event(FolderEvent::ReadApp, read_app_handler) .event(FolderEvent::UpdateApp, update_app_handler) .event(FolderEvent::DeleteApp, delete_app_handler); + // View module = module .event(FolderEvent::CreateView, create_view_handler) .event(FolderEvent::ReadView, read_view_handler) @@ -68,6 +71,7 @@ pub fn create(folder: Arc) -> Module { .event(FolderEvent::CloseView, close_view_handler) .event(FolderEvent::MoveFolderItem, move_item_handler); + // Trash module = module .event(FolderEvent::ReadTrash, read_trash_handler) .event(FolderEvent::PutbackTrash, putback_trash_handler) diff --git a/frontend/rust-lib/flowy-folder/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rs index d9664004c9..8f5f318f95 100644 --- a/frontend/rust-lib/flowy-folder/src/manager.rs +++ b/frontend/rust-lib/flowy-folder/src/manager.rs @@ -14,6 +14,7 @@ use flowy_sync::client_document::default::{initial_quill_delta_string, initial_r use flowy_error::FlowyError; use flowy_folder_data_model::entities::view::ViewDataType; +use flowy_folder_data_model::entities::UpdateViewInfoParams; use flowy_folder_data_model::user_default; use flowy_revision::disk::SQLiteTextBlockRevisionPersistence; use flowy_revision::{RevisionManager, RevisionPersistence, RevisionWebSocket}; @@ -244,11 +245,18 @@ pub trait ViewDataProcessor { fn close_container(&self, view_id: &str) -> FutureResult<(), FlowyError>; - fn view_delta_data(&self, view_id: &str) -> FutureResult; + fn get_delta_data(&self, view_id: &str) -> FutureResult; fn create_default_view(&self, user_id: &str, view_id: &str) -> FutureResult; - fn process_view_delta_data(&self, user_id: &str, view_id: &str, data: Vec) -> FutureResult; + fn create_view_from_delta_data( + &self, + user_id: &str, + view_id: &str, + data: Vec, + ) -> FutureResult; + + fn handle_view_info_updated(&self, params: UpdateViewInfoParams) -> FutureResult<(), FlowyError>; fn data_type(&self) -> ViewDataType; } diff --git a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs index ce701e705a..7f8e910424 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs @@ -15,7 +15,7 @@ use crate::{ use bytes::Bytes; use flowy_database::kv::KV; use flowy_folder_data_model::entities::view::{gen_view_id, ViewDataType}; -use flowy_folder_data_model::entities::{ViewExtData, ViewInfo}; +use flowy_folder_data_model::entities::{UpdateViewInfoParams, ViewExtData, ViewInfo}; use flowy_folder_data_model::revision::ViewRevision; use flowy_sync::entities::text_block_info::TextBlockId; use futures::{FutureExt, StreamExt}; @@ -65,7 +65,7 @@ impl ViewController { params.data = view_data.to_vec(); } else { let delta_data = processor - .process_view_delta_data(&user_id, ¶ms.view_id, params.data.clone()) + .create_view_from_delta_data(&user_id, ¶ms.view_id, params.data.clone()) .await?; let _ = self .create_view(¶ms.view_id, params.data_type.clone(), delta_data) @@ -211,7 +211,7 @@ impl ViewController { .await?; let processor = self.get_data_processor(&view_rev.data_type)?; - let delta_bytes = processor.view_delta_data(view_id).await?; + let delta_bytes = processor.get_delta_data(view_id).await?; let duplicate_params = CreateViewParams { belong_to_id: view_rev.belong_to_id.clone(), name: format!("{} (copy)", &view_rev.name), @@ -259,6 +259,28 @@ impl ViewController { Ok(view_rev) } + #[tracing::instrument(level = "debug", skip(self, params), err)] + pub(crate) async fn update_view_info(&self, params: UpdateViewInfoParams) -> Result { + let changeset = ViewChangeset::new(params.clone()); + let view_id = changeset.id.clone(); + let view_rev = self + .persistence + .begin_transaction(|transaction| { + let _ = transaction.update_view(changeset)?; + let view_rev = transaction.read_view(&view_id)?; + let view: View = view_rev.clone().into(); + send_dart_notification(&view_id, FolderNotification::ViewUpdated) + .payload(view) + .send(); + let _ = notify_views_changed(&view_rev.belong_to_id, self.trash_controller.clone(), &transaction)?; + Ok(view_rev) + }) + .await?; + + let _ = self.update_view_on_server(params); + Ok(view_rev) + } + pub(crate) async fn latest_visit_view(&self) -> FlowyResult> { match KV::get_str(LATEST_VIEW_ID) { None => Ok(None), diff --git a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs index 85efa862ef..691f3fb058 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs @@ -11,7 +11,7 @@ use crate::{ services::{TrashController, ViewController}, }; use flowy_folder_data_model::entities::view::{MoveFolderItemParams, MoveFolderItemPayload, MoveFolderItemType}; -use flowy_folder_data_model::entities::ViewInfo; +use flowy_folder_data_model::entities::{UpdateViewInfoParams, UpdateViewInfoPayload, ViewInfo}; use flowy_folder_data_model::revision::TrashRevision; use lib_dispatch::prelude::{data_result, AppData, Data, DataResult}; use std::{convert::TryInto, sync::Arc}; @@ -56,11 +56,11 @@ pub(crate) async fn update_view_handler( #[tracing::instrument(level = "debug", skip(data, controller), err)] pub(crate) async fn update_view_info_handler( - data: Data, + data: Data, controller: AppData>, ) -> Result<(), FlowyError> { - let params: UpdateViewParams = data.into_inner().try_into()?; - let _ = controller.update_view(params).await?; + let params: UpdateViewInfoParams = data.into_inner().try_into()?; + let _ = controller.update_view_info(params).await?; Ok(()) } diff --git a/frontend/rust-lib/flowy-grid/src/manager.rs b/frontend/rust-lib/flowy-grid/src/manager.rs index 2965cb5bd9..18ff4f654f 100644 --- a/frontend/rust-lib/flowy-grid/src/manager.rs +++ b/frontend/rust-lib/flowy-grid/src/manager.rs @@ -89,6 +89,8 @@ impl GridManager { Ok(()) } + // pub fn update_grid_info() + // #[tracing::instrument(level = "debug", skip(self), err)] pub fn get_grid_editor(&self, grid_id: &str) -> FlowyResult> { match self.editor_map.get(grid_id) { diff --git a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs index 846dddd55e..40f091d46b 100644 --- a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs +++ b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs @@ -26,6 +26,7 @@ use lib_infra::future::{BoxResultFuture, FutureResult}; use lib_ws::{WSChannel, WSMessageReceiver, WebSocketRawMessage}; use std::collections::HashMap; +use flowy_folder::entities::UpdateViewInfoParams; use flowy_grid_data_model::entities::BuildGridContext; use std::convert::TryFrom; use std::{convert::TryInto, sync::Arc}; @@ -173,7 +174,7 @@ impl ViewDataProcessor for TextBlockViewDataProcessor { }) } - fn view_delta_data(&self, view_id: &str) -> FutureResult { + fn get_delta_data(&self, view_id: &str) -> FutureResult { let view_id = view_id.to_string(); let manager = self.0.clone(); FutureResult::new(async move { @@ -197,7 +198,7 @@ impl ViewDataProcessor for TextBlockViewDataProcessor { }) } - fn process_view_delta_data( + fn create_view_from_delta_data( &self, _user_id: &str, _view_id: &str, @@ -206,6 +207,11 @@ impl ViewDataProcessor for TextBlockViewDataProcessor { FutureResult::new(async move { Ok(Bytes::from(data)) }) } + fn handle_view_info_updated(&self, _params: UpdateViewInfoParams) -> FutureResult<(), FlowyError> { + tracing::warn!("Unimplemented the handle_view_info_updated in TextBlock"); + FutureResult::new(async { Ok(()) }) + } + fn data_type(&self) -> ViewDataType { ViewDataType::TextBlock } @@ -245,7 +251,7 @@ impl ViewDataProcessor for GridViewDataProcessor { }) } - fn view_delta_data(&self, view_id: &str) -> FutureResult { + fn get_delta_data(&self, view_id: &str) -> FutureResult { let view_id = view_id.to_string(); let grid_manager = self.0.clone(); FutureResult::new(async move { @@ -264,7 +270,12 @@ impl ViewDataProcessor for GridViewDataProcessor { FutureResult::new(async move { make_grid_view_data(&user_id, &view_id, grid_manager, build_context).await }) } - fn process_view_delta_data(&self, user_id: &str, view_id: &str, data: Vec) -> FutureResult { + fn create_view_from_delta_data( + &self, + user_id: &str, + view_id: &str, + data: Vec, + ) -> FutureResult { let user_id = user_id.to_string(); let view_id = view_id.to_string(); let grid_manager = self.0.clone(); @@ -276,6 +287,10 @@ impl ViewDataProcessor for GridViewDataProcessor { }) } + fn handle_view_info_updated(&self, params: UpdateViewInfoParams) -> FutureResult<(), FlowyError> { + todo!() + } + fn data_type(&self) -> ViewDataType { ViewDataType::Grid } diff --git a/shared-lib/flowy-error-code/src/code.rs b/shared-lib/flowy-error-code/src/code.rs index 8941684948..352c4abbdb 100644 --- a/shared-lib/flowy-error-code/src/code.rs +++ b/shared-lib/flowy-error-code/src/code.rs @@ -114,6 +114,9 @@ pub enum ErrorCode { #[display(fmt = "Invalid date time format")] InvalidDateTimeFormat = 500, + #[display(fmt = "The input string is empty or contains invalid characters")] + UnexpectedEmptyString = 999, + #[display(fmt = "Invalid data")] InvalidData = 1000, } diff --git a/shared-lib/flowy-folder-data-model/src/entities/view_info.rs b/shared-lib/flowy-folder-data-model/src/entities/view_info.rs index 7cb598e534..a4f0fd8645 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/view_info.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/view_info.rs @@ -1,5 +1,6 @@ use crate::entities::{RepeatedView, ViewDataType}; use crate::parser::view::ViewIdentify; +use crate::parser::view_info::{ViewFilterParser, ViewGroupParser, ViewSortParser}; use flowy_derive::ProtoBuf; use flowy_error_code::ErrorCode; use std::convert::TryInto; @@ -43,22 +44,22 @@ pub struct ViewExtData { #[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] pub struct ViewFilter { #[pb(index = 1)] - pub field_id: String, + pub object_id: String, } #[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] pub struct ViewGroup { #[pb(index = 1)] - pub group_field_id: String, + pub group_object_id: String, #[pb(index = 2, one_of)] - pub sub_group_field_id: Option, + pub sub_group_object_id: Option, } #[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] pub struct ViewSort { #[pb(index = 1)] - pub field_id: String, + pub object_id: String, } #[derive(Default, ProtoBuf)] @@ -82,3 +83,33 @@ pub struct UpdateViewInfoParams { pub group: Option, pub sort: Option, } + +impl TryInto for UpdateViewInfoPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let view_id = ViewIdentify::parse(self.view_id)?.0; + + let filter = match self.filter { + None => None, + Some(filter) => Some(ViewFilterParser::parse(filter)?), + }; + + let group = match self.group { + None => None, + Some(group) => Some(ViewGroupParser::parse(group)?), + }; + + let sort = match self.sort { + None => None, + Some(sort) => Some(ViewSortParser::parse(sort)?), + }; + + Ok(UpdateViewInfoParams { + view_id, + filter, + group, + sort, + }) + } +} diff --git a/shared-lib/flowy-folder-data-model/src/parser/mod.rs b/shared-lib/flowy-folder-data-model/src/parser/mod.rs index 3ee0f4b591..5f16ba6b38 100644 --- a/shared-lib/flowy-folder-data-model/src/parser/mod.rs +++ b/shared-lib/flowy-folder-data-model/src/parser/mod.rs @@ -1,4 +1,5 @@ pub mod app; pub mod trash; pub mod view; +pub mod view_info; pub mod workspace; diff --git a/shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs b/shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs new file mode 100644 index 0000000000..fc7202c4cb --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs @@ -0,0 +1,5 @@ +mod object_id; +mod view_ext; + +pub use object_id::*; +pub use view_ext::*; diff --git a/shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs b/shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs new file mode 100644 index 0000000000..155dea5fa8 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs @@ -0,0 +1,19 @@ +use crate::errors::ErrorCode; + +#[derive(Debug)] +pub struct ObjectId(pub String); + +impl ObjectId { + pub fn parse(s: String) -> Result { + if s.trim().is_empty() { + return Err(ErrorCode::UnexpectedEmptyString); + } + Ok(Self(s)) + } +} + +impl AsRef for ObjectId { + fn as_ref(&self) -> &str { + &self.0 + } +} diff --git a/shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs b/shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs new file mode 100644 index 0000000000..80d1d56f51 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs @@ -0,0 +1,40 @@ +use crate::entities::{ViewFilter, ViewGroup, ViewSort}; +use crate::errors::ErrorCode; +use crate::parser::view_info::ObjectId; + +pub struct ViewFilterParser(pub ViewFilter); + +impl ViewFilterParser { + pub fn parse(value: ViewFilter) -> Result { + let object_id = ObjectId::parse(value.object_id)?.0; + Ok(ViewFilter { object_id }) + } +} + +pub struct ViewGroupParser(pub ViewGroup); + +impl ViewGroupParser { + pub fn parse(value: ViewGroup) -> Result { + let group_object_id = ObjectId::parse(value.group_object_id)?.0; + + let sub_group_object_id = match value.sub_group_object_id { + None => None, + Some(object_id) => Some(ObjectId::parse(object_id)?.0), + }; + + Ok(ViewGroup { + group_object_id, + sub_group_object_id, + }) + } +} + +pub struct ViewSortParser(pub ViewSort); + +impl ViewSortParser { + pub fn parse(value: ViewSort) -> Result { + let object_id = ObjectId::parse(value.object_id)?.0; + + Ok(ViewSort { object_id }) + } +} diff --git a/shared-lib/flowy-folder-data-model/src/revision/view.rs b/shared-lib/flowy-folder-data-model/src/revision/view.rs index e58ee95928..63a87bf82c 100644 --- a/shared-lib/flowy-folder-data-model/src/revision/view.rs +++ b/shared-lib/flowy-folder-data-model/src/revision/view.rs @@ -111,22 +111,26 @@ impl std::convert::From for ViewExtData { impl std::convert::From for ViewFilter { fn from(rev: ViewFilterRevision) -> Self { - ViewFilter { field_id: rev.field_id } + ViewFilter { + object_id: rev.field_id, + } } } impl std::convert::From for ViewGroup { fn from(rev: ViewGroupRevision) -> Self { ViewGroup { - group_field_id: rev.group_field_id, - sub_group_field_id: rev.sub_group_field_id, + group_object_id: rev.group_field_id, + sub_group_object_id: rev.sub_group_field_id, } } } impl std::convert::From for ViewSort { fn from(rev: ViewSortRevision) -> Self { - ViewSort { field_id: rev.field_id } + ViewSort { + object_id: rev.field_id, + } } } From a13e6798ee57960bdfdac9bf574a178fcb6d20e9 Mon Sep 17 00:00:00 2001 From: appflowy Date: Wed, 15 Jun 2022 15:13:50 +0800 Subject: [PATCH 10/11] refactor: separate grid revision structs from entities --- .../grid/cell/cell_service/cell_service.dart | 1 + .../application/grid/cell/date_cell_bloc.dart | 2 +- .../grid/field/field_action_sheet_bloc.dart | 2 +- .../grid/field/field_cell_bloc.dart | 2 +- .../grid/field/field_editor_pannel_bloc.dart | 2 +- .../grid/field/field_listener.dart | 2 +- .../application/grid/field/field_service.dart | 1 + .../application/grid/field/grid_listenr.dart | 2 +- .../type_option/type_option_service.dart | 2 +- .../application/grid/grid_header_bloc.dart | 2 +- .../application/grid/grid_service.dart | 1 + .../application/grid/row/row_bloc.dart | 2 +- .../application/grid/row/row_listener.dart | 1 + .../application/grid/row/row_service.dart | 1 + .../grid/setting/property_bloc.dart | 2 +- .../plugins/grid/src/layout/layout.dart | 3 +- .../grid/src/widgets/cell/cell_builder.dart | 2 +- .../grid/src/widgets/header/field_cell.dart | 2 +- .../widgets/header/field_editor_pannel.dart | 2 +- .../widgets/header/field_type_extension.dart | 2 +- .../src/widgets/header/field_type_list.dart | 2 +- .../grid/src/widgets/header/grid_header.dart | 2 +- .../grid/src/widgets/row/row_detail.dart | 2 +- .../src/widgets/toolbar/grid_property.dart | 2 +- .../dart_event/flowy-folder/dart_event.dart | 17 + .../flowy-error-code/code.pbenum.dart | 2 + .../flowy-error-code/code.pbjson.dart | 3 +- .../flowy-folder-data-model/view_info.pb.dart | 212 +- .../view_info.pbjson.dart | 34 +- .../flowy-folder/event_map.pbenum.dart | 2 + .../flowy-folder/event_map.pbjson.dart | 3 +- .../flowy-grid-data-model/field.pb.dart | 1246 +++++ .../flowy-grid-data-model/field.pbenum.dart | 36 + .../flowy-grid-data-model/field.pbjson.dart | 215 + .../flowy-grid-data-model/field.pbserver.dart | 9 + .../flowy-grid-data-model/grid.pb.dart | 1239 +---- .../flowy-grid-data-model/grid.pbenum.dart | 25 - .../flowy-grid-data-model/grid.pbjson.dart | 205 - .../flowy-grid-data-model/protobuf.dart | 1 + .../src/protobuf/model/event_map.rs | 16 +- .../src/protobuf/proto/event_map.proto | 1 + .../src/services/view/controller.rs | 23 +- .../rust-lib/flowy-grid/src/event_handler.rs | 59 +- frontend/rust-lib/flowy-grid/src/macros.rs | 6 +- frontend/rust-lib/flowy-grid/src/manager.rs | 8 +- ...block_meta_manager.rs => block_manager.rs} | 90 +- ...eta_editor.rs => block_revision_editor.rs} | 45 +- .../src/services/field/field_builder.rs | 35 +- .../type_options/checkbox_type_option.rs | 36 +- .../field/type_options/date_type_option.rs | 75 +- .../number_type_option/number_type_option.rs | 73 +- .../type_options/selection_type_option.rs | 79 +- .../field/type_options/text_type_option.rs | 29 +- .../field/type_options/url_type_option.rs | 30 +- .../src/services/field/type_options/util.rs | 6 +- .../flowy-grid/src/services/grid_editor.rs | 179 +- .../rust-lib/flowy-grid/src/services/mod.rs | 4 +- .../src/services/row/cell_data_operation.rs | 63 +- .../src/services/row/row_builder.rs | 34 +- .../flowy-grid/src/services/row/row_loader.rs | 59 +- frontend/rust-lib/flowy-grid/src/util.rs | 3 +- .../flowy-grid/tests/grid/grid_test.rs | 72 +- .../rust-lib/flowy-grid/tests/grid/script.rs | 150 +- .../flowy-sdk/src/deps_resolve/folder_deps.rs | 15 +- .../src/protobuf/model/code.rs | 9 +- .../src/protobuf/proto/code.proto | 1 + .../src/protobuf/model/view_info.rs | 634 ++- .../src/protobuf/proto/view_info.proto | 14 +- shared-lib/flowy-grid-data-model/Flowy.toml | 2 +- .../src/entities/field.rs | 525 +++ .../src/entities/grid.rs | 592 +-- .../flowy-grid-data-model/src/entities/mod.rs | 4 +- shared-lib/flowy-grid-data-model/src/lib.rs | 1 + .../src/protobuf/model/field.rs | 4104 ++++++++++++++++ .../src/protobuf/model/grid.rs | 4167 +---------------- .../src/protobuf/model/mod.rs | 3 + .../src/protobuf/proto/field.proto | 87 + .../src/protobuf/proto/grid.proto | 86 +- .../src/{entities/meta.rs => revision/mod.rs} | 109 +- .../flowy-grid-data-model/tests/serde_test.rs | 4 +- ..._meta_pad.rs => grid_block_revsion_pad.rs} | 149 +- .../src/client_grid/grid_builder.rs | 33 +- ...{grid_meta_pad.rs => grid_revision_pad.rs} | 143 +- shared-lib/flowy-sync/src/client_grid/mod.rs | 8 +- 84 files changed, 7940 insertions(+), 7218 deletions(-) create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pb.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbenum.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbjson.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbserver.dart rename frontend/rust-lib/flowy-grid/src/services/{block_meta_manager.rs => block_manager.rs} (76%) rename frontend/rust-lib/flowy-grid/src/services/{block_meta_editor.rs => block_revision_editor.rs} (81%) create mode 100644 shared-lib/flowy-grid-data-model/src/entities/field.rs create mode 100644 shared-lib/flowy-grid-data-model/src/protobuf/model/field.rs create mode 100644 shared-lib/flowy-grid-data-model/src/protobuf/proto/field.proto rename shared-lib/flowy-grid-data-model/src/{entities/meta.rs => revision/mod.rs} (66%) rename shared-lib/flowy-sync/src/client_grid/{grid_block_meta_pad.rs => grid_block_revsion_pad.rs} (72%) rename shared-lib/flowy-sync/src/client_grid/{grid_meta_pad.rs => grid_revision_pad.rs} (72%) diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_service.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_service.dart index 68f8eada78..9283c0d22b 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_service.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_service.dart @@ -6,6 +6,7 @@ import 'package:equatable/equatable.dart'; import 'package:flowy_sdk/dispatch/dispatch.dart'; import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/cell_entities.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/date_type_option.pb.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart index b9f4c74070..0cb4c8f051 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart @@ -1,4 +1,4 @@ -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show Field; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/date_type_option.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/field_action_sheet_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/field/field_action_sheet_bloc.dart index 25c9cbfc0d..ef0522b505 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/field_action_sheet_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/field_action_sheet_bloc.dart @@ -1,5 +1,5 @@ import 'package:flowy_sdk/log.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'dart:async'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/field_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/field/field_cell_bloc.dart index c7e83cc52e..0101327a04 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/field_cell_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/field_cell_bloc.dart @@ -1,7 +1,7 @@ import 'package:app_flowy/workspace/application/grid/field/field_listener.dart'; import 'package:app_flowy/workspace/application/grid/field/field_service.dart'; import 'package:flowy_sdk/log.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show Field; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'dart:async'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/field_editor_pannel_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/field/field_editor_pannel_bloc.dart index c6d48c9d18..ba3350b2c2 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/field_editor_pannel_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/field_editor_pannel_bloc.dart @@ -1,4 +1,4 @@ -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'dart:async'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/field_listener.dart b/frontend/app_flowy/lib/workspace/application/grid/field/field_listener.dart index ec4ef77f30..1cf711e72f 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/field_listener.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/field_listener.dart @@ -1,6 +1,6 @@ import 'package:dartz/dartz.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/dart_notification.pb.dart'; import 'package:flowy_infra/notifier.dart'; import 'dart:async'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart b/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart index 36547071b9..d4b2b78b43 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart @@ -2,6 +2,7 @@ import 'package:dartz/dartz.dart'; import 'package:flowy_sdk/dispatch/dispatch.dart'; import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart'; import 'package:flutter/foundation.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/grid_listenr.dart b/frontend/app_flowy/lib/workspace/application/grid/field/grid_listenr.dart index e97d24a3e1..58fa59a1e7 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/grid_listenr.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/grid_listenr.dart @@ -1,5 +1,5 @@ import 'package:dartz/dartz.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/dart_notification.pb.dart'; import 'package:flowy_infra/notifier.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/type_option/type_option_service.dart b/frontend/app_flowy/lib/workspace/application/grid/field/type_option/type_option_service.dart index 4bf61cc1ff..683b13e9ec 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/type_option/type_option_service.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/type_option/type_option_service.dart @@ -4,7 +4,7 @@ import 'package:app_flowy/workspace/application/grid/field/field_service.dart'; import 'package:dartz/dartz.dart'; import 'package:flowy_sdk/dispatch/dispatch.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/cell_entities.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/selection_type_option.pb.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/grid_header_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/grid_header_bloc.dart index 526dda9085..3e6bd57d71 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/grid_header_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/grid_header_bloc.dart @@ -1,6 +1,6 @@ import 'package:app_flowy/workspace/application/grid/field/field_service.dart'; import 'package:flowy_sdk/log.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'dart:async'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart b/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart index 38ebfc63fc..3380ad4349 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart @@ -6,6 +6,7 @@ import 'package:flowy_sdk/dispatch/dispatch.dart'; import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flutter/foundation.dart'; import 'cell/cell_service/cell_service.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/row/row_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/row/row_bloc.dart index d8000e3664..56d3397da0 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/row/row_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/row/row_bloc.dart @@ -1,7 +1,7 @@ import 'dart:collection'; import 'package:app_flowy/workspace/application/grid/cell/cell_service/cell_service.dart'; import 'package:equatable/equatable.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show Field; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'dart:async'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/row/row_listener.dart b/frontend/app_flowy/lib/workspace/application/grid/row/row_listener.dart index 7d947b8482..19dd8229d3 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/row/row_listener.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/row/row_listener.dart @@ -1,4 +1,5 @@ import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/dart_notification.pb.dart'; import 'package:flowy_infra/notifier.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/row/row_service.dart b/frontend/app_flowy/lib/workspace/application/grid/row/row_service.dart index 07712ec845..64fa164251 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/row/row_service.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/row/row_service.dart @@ -5,6 +5,7 @@ import 'package:dartz/dartz.dart'; import 'package:flowy_sdk/dispatch/dispatch.dart'; import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/row_entities.pb.dart'; import 'package:flutter/foundation.dart'; diff --git a/frontend/app_flowy/lib/workspace/application/grid/setting/property_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/setting/property_bloc.dart index a88423e56d..69729d8224 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/setting/property_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/setting/property_bloc.dart @@ -1,7 +1,7 @@ import 'package:app_flowy/workspace/application/grid/field/field_service.dart'; import 'package:app_flowy/workspace/application/grid/grid_service.dart'; import 'package:flowy_sdk/log.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'dart:async'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/layout/layout.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/layout/layout.dart index 3f076fc89f..73ed2221ec 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/layout/layout.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/layout/layout.dart @@ -1,5 +1,4 @@ -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; - +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'sizes.dart'; class GridLayout { diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart index 7147272038..b7f9b8e86f 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart @@ -1,5 +1,5 @@ import 'package:app_flowy/workspace/application/grid/cell/cell_service/cell_service.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_cell.dart index 5071161d5a..12a633ee92 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_cell.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_cell.dart @@ -6,7 +6,7 @@ import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show Field; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'field_type_extension.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor_pannel.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor_pannel.dart index 63b790b02c..73d99a7966 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor_pannel.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor_pannel.dart @@ -10,7 +10,7 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:app_flowy/workspace/application/grid/prelude.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_extension.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_extension.dart index 035d101544..cf498926d9 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_extension.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_extension.dart @@ -1,4 +1,4 @@ -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:app_flowy/generated/locale_keys.g.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart index bfced8f421..be1e32906c 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart @@ -6,7 +6,7 @@ import 'package:flowy_infra_ui/style_widget/button.dart'; import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter/material.dart'; import 'field_type_extension.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/grid_header.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/grid_header.dart index 5e1296191b..4686ae755f 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/grid_header.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/grid_header.dart @@ -5,7 +5,7 @@ import 'package:flowy_infra/image.dart'; import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' hide Row; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:reorderables/reorderables.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart index 719e0082fb..637489362d 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart @@ -14,7 +14,7 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/icon_button.dart'; import 'package:flowy_infra_ui/style_widget/scrolling/styled_scroll_bar.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:app_flowy/generated/locale_keys.g.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/toolbar/grid_property.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/toolbar/grid_property.dart index c971b48479..4185fcef51 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/toolbar/grid_property.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/toolbar/grid_property.dart @@ -12,7 +12,7 @@ import 'package:flowy_infra_ui/style_widget/button.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:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show Field; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/field.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:styled_widget/styled_widget.dart'; diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart index 064fae1fa4..e411bf9f00 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart @@ -287,6 +287,23 @@ class FolderEventReadViewInfo { } } +class FolderEventUpdateViewInfo { + UpdateViewInfoPayload request; + FolderEventUpdateViewInfo(this.request); + + Future> send() { + final request = FFIRequest.create() + ..event = FolderEvent.UpdateViewInfo.toString() + ..payload = requestToBytes(this.request); + + return Dispatch.asyncRequest(request) + .then((bytesResult) => bytesResult.fold( + (okBytes) => left(ViewInfo.fromBuffer(okBytes)), + (errBytes) => right(FlowyError.fromBuffer(errBytes)), + )); + } +} + class FolderEventCopyLink { FolderEventCopyLink(); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbenum.dart index 295a485d01..8332a790d4 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbenum.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbenum.dart @@ -53,6 +53,7 @@ class ErrorCode extends $pb.ProtobufEnum { static const ErrorCode FieldInvalidOperation = ErrorCode._(444, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'FieldInvalidOperation'); static const ErrorCode TypeOptionDataIsEmpty = ErrorCode._(450, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'TypeOptionDataIsEmpty'); static const ErrorCode InvalidDateTimeFormat = ErrorCode._(500, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'InvalidDateTimeFormat'); + static const ErrorCode UnexpectedEmptyString = ErrorCode._(999, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UnexpectedEmptyString'); static const ErrorCode InvalidData = ErrorCode._(1000, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'InvalidData'); static const $core.List values = [ @@ -99,6 +100,7 @@ class ErrorCode extends $pb.ProtobufEnum { FieldInvalidOperation, TypeOptionDataIsEmpty, InvalidDateTimeFormat, + UnexpectedEmptyString, InvalidData, ]; diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbjson.dart index 1d3717a2b5..738c16b9b8 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-error-code/code.pbjson.dart @@ -55,9 +55,10 @@ const ErrorCode$json = const { const {'1': 'FieldInvalidOperation', '2': 444}, const {'1': 'TypeOptionDataIsEmpty', '2': 450}, const {'1': 'InvalidDateTimeFormat', '2': 500}, + const {'1': 'UnexpectedEmptyString', '2': 999}, const {'1': 'InvalidData', '2': 1000}, ], }; /// Descriptor for `ErrorCode`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List errorCodeDescriptor = $convert.base64Decode('CglFcnJvckNvZGUSDAoISW50ZXJuYWwQABIUChBVc2VyVW5hdXRob3JpemVkEAISEgoOUmVjb3JkTm90Rm91bmQQAxIRCg1Vc2VySWRJc0VtcHR5EAQSGAoUV29ya3NwYWNlTmFtZUludmFsaWQQZBIWChJXb3Jrc3BhY2VJZEludmFsaWQQZRIYChRBcHBDb2xvclN0eWxlSW52YWxpZBBmEhgKFFdvcmtzcGFjZURlc2NUb29Mb25nEGcSGAoUV29ya3NwYWNlTmFtZVRvb0xvbmcQaBIQCgxBcHBJZEludmFsaWQQbhISCg5BcHBOYW1lSW52YWxpZBBvEhMKD1ZpZXdOYW1lSW52YWxpZBB4EhgKFFZpZXdUaHVtYm5haWxJbnZhbGlkEHkSEQoNVmlld0lkSW52YWxpZBB6EhMKD1ZpZXdEZXNjVG9vTG9uZxB7EhMKD1ZpZXdEYXRhSW52YWxpZBB8EhMKD1ZpZXdOYW1lVG9vTG9uZxB9EhEKDENvbm5lY3RFcnJvchDIARIRCgxFbWFpbElzRW1wdHkQrAISFwoSRW1haWxGb3JtYXRJbnZhbGlkEK0CEhcKEkVtYWlsQWxyZWFkeUV4aXN0cxCuAhIUCg9QYXNzd29yZElzRW1wdHkQrwISFAoPUGFzc3dvcmRUb29Mb25nELACEiUKIFBhc3N3b3JkQ29udGFpbnNGb3JiaWRDaGFyYWN0ZXJzELECEhoKFVBhc3N3b3JkRm9ybWF0SW52YWxpZBCyAhIVChBQYXNzd29yZE5vdE1hdGNoELMCEhQKD1VzZXJOYW1lVG9vTG9uZxC0AhInCiJVc2VyTmFtZUNvbnRhaW5Gb3JiaWRkZW5DaGFyYWN0ZXJzELUCEhQKD1VzZXJOYW1lSXNFbXB0eRC2AhISCg1Vc2VySWRJbnZhbGlkELcCEhEKDFVzZXJOb3RFeGlzdBC4AhIQCgtUZXh0VG9vTG9uZxCQAxISCg1HcmlkSWRJc0VtcHR5EJoDEhMKDkJsb2NrSWRJc0VtcHR5EKQDEhEKDFJvd0lkSXNFbXB0eRCuAxIUCg9PcHRpb25JZElzRW1wdHkQrwMSEwoORmllbGRJZElzRW1wdHkQuAMSFgoRRmllbGREb2VzTm90RXhpc3QQuQMSHAoXU2VsZWN0T3B0aW9uTmFtZUlzRW1wdHkQugMSEwoORmllbGROb3RFeGlzdHMQuwMSGgoVRmllbGRJbnZhbGlkT3BlcmF0aW9uELwDEhoKFVR5cGVPcHRpb25EYXRhSXNFbXB0eRDCAxIaChVJbnZhbGlkRGF0ZVRpbWVGb3JtYXQQ9AMSEAoLSW52YWxpZERhdGEQ6Ac='); +final $typed_data.Uint8List errorCodeDescriptor = $convert.base64Decode('CglFcnJvckNvZGUSDAoISW50ZXJuYWwQABIUChBVc2VyVW5hdXRob3JpemVkEAISEgoOUmVjb3JkTm90Rm91bmQQAxIRCg1Vc2VySWRJc0VtcHR5EAQSGAoUV29ya3NwYWNlTmFtZUludmFsaWQQZBIWChJXb3Jrc3BhY2VJZEludmFsaWQQZRIYChRBcHBDb2xvclN0eWxlSW52YWxpZBBmEhgKFFdvcmtzcGFjZURlc2NUb29Mb25nEGcSGAoUV29ya3NwYWNlTmFtZVRvb0xvbmcQaBIQCgxBcHBJZEludmFsaWQQbhISCg5BcHBOYW1lSW52YWxpZBBvEhMKD1ZpZXdOYW1lSW52YWxpZBB4EhgKFFZpZXdUaHVtYm5haWxJbnZhbGlkEHkSEQoNVmlld0lkSW52YWxpZBB6EhMKD1ZpZXdEZXNjVG9vTG9uZxB7EhMKD1ZpZXdEYXRhSW52YWxpZBB8EhMKD1ZpZXdOYW1lVG9vTG9uZxB9EhEKDENvbm5lY3RFcnJvchDIARIRCgxFbWFpbElzRW1wdHkQrAISFwoSRW1haWxGb3JtYXRJbnZhbGlkEK0CEhcKEkVtYWlsQWxyZWFkeUV4aXN0cxCuAhIUCg9QYXNzd29yZElzRW1wdHkQrwISFAoPUGFzc3dvcmRUb29Mb25nELACEiUKIFBhc3N3b3JkQ29udGFpbnNGb3JiaWRDaGFyYWN0ZXJzELECEhoKFVBhc3N3b3JkRm9ybWF0SW52YWxpZBCyAhIVChBQYXNzd29yZE5vdE1hdGNoELMCEhQKD1VzZXJOYW1lVG9vTG9uZxC0AhInCiJVc2VyTmFtZUNvbnRhaW5Gb3JiaWRkZW5DaGFyYWN0ZXJzELUCEhQKD1VzZXJOYW1lSXNFbXB0eRC2AhISCg1Vc2VySWRJbnZhbGlkELcCEhEKDFVzZXJOb3RFeGlzdBC4AhIQCgtUZXh0VG9vTG9uZxCQAxISCg1HcmlkSWRJc0VtcHR5EJoDEhMKDkJsb2NrSWRJc0VtcHR5EKQDEhEKDFJvd0lkSXNFbXB0eRCuAxIUCg9PcHRpb25JZElzRW1wdHkQrwMSEwoORmllbGRJZElzRW1wdHkQuAMSFgoRRmllbGREb2VzTm90RXhpc3QQuQMSHAoXU2VsZWN0T3B0aW9uTmFtZUlzRW1wdHkQugMSEwoORmllbGROb3RFeGlzdHMQuwMSGgoVRmllbGRJbnZhbGlkT3BlcmF0aW9uELwDEhoKFVR5cGVPcHRpb25EYXRhSXNFbXB0eRDCAxIaChVJbnZhbGlkRGF0ZVRpbWVGb3JtYXQQ9AMSGgoVVW5leHBlY3RlZEVtcHR5U3RyaW5nEOcHEhAKC0ludmFsaWREYXRhEOgH'); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart index 11d6115cfb..6351757563 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart @@ -231,17 +231,17 @@ class ViewExtData extends $pb.GeneratedMessage { class ViewFilter extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewFilter', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'objectId') ..hasRequiredFields = false ; ViewFilter._() : super(); factory ViewFilter({ - $core.String? fieldId, + $core.String? objectId, }) { final _result = create(); - if (fieldId != null) { - _result.fieldId = fieldId; + if (objectId != null) { + _result.objectId = objectId; } return _result; } @@ -267,43 +267,43 @@ class ViewFilter extends $pb.GeneratedMessage { static ViewFilter? _defaultInstance; @$pb.TagNumber(1) - $core.String get fieldId => $_getSZ(0); + $core.String get objectId => $_getSZ(0); @$pb.TagNumber(1) - set fieldId($core.String v) { $_setString(0, v); } + set objectId($core.String v) { $_setString(0, v); } @$pb.TagNumber(1) - $core.bool hasFieldId() => $_has(0); + $core.bool hasObjectId() => $_has(0); @$pb.TagNumber(1) - void clearFieldId() => clearField(1); + void clearObjectId() => clearField(1); } -enum ViewGroup_OneOfSubGroupFieldId { - subGroupFieldId, +enum ViewGroup_OneOfSubGroupObjectId { + subGroupObjectId, notSet } class ViewGroup extends $pb.GeneratedMessage { - static const $core.Map<$core.int, ViewGroup_OneOfSubGroupFieldId> _ViewGroup_OneOfSubGroupFieldIdByTag = { - 2 : ViewGroup_OneOfSubGroupFieldId.subGroupFieldId, - 0 : ViewGroup_OneOfSubGroupFieldId.notSet + static const $core.Map<$core.int, ViewGroup_OneOfSubGroupObjectId> _ViewGroup_OneOfSubGroupObjectIdByTag = { + 2 : ViewGroup_OneOfSubGroupObjectId.subGroupObjectId, + 0 : ViewGroup_OneOfSubGroupObjectId.notSet }; static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewGroup', createEmptyInstance: create) ..oo(0, [2]) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'groupFieldId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subGroupFieldId') + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'groupObjectId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subGroupObjectId') ..hasRequiredFields = false ; ViewGroup._() : super(); factory ViewGroup({ - $core.String? groupFieldId, - $core.String? subGroupFieldId, + $core.String? groupObjectId, + $core.String? subGroupObjectId, }) { final _result = create(); - if (groupFieldId != null) { - _result.groupFieldId = groupFieldId; + if (groupObjectId != null) { + _result.groupObjectId = groupObjectId; } - if (subGroupFieldId != null) { - _result.subGroupFieldId = subGroupFieldId; + if (subGroupObjectId != null) { + _result.subGroupObjectId = subGroupObjectId; } return _result; } @@ -328,41 +328,41 @@ class ViewGroup extends $pb.GeneratedMessage { static ViewGroup getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ViewGroup? _defaultInstance; - ViewGroup_OneOfSubGroupFieldId whichOneOfSubGroupFieldId() => _ViewGroup_OneOfSubGroupFieldIdByTag[$_whichOneof(0)]!; - void clearOneOfSubGroupFieldId() => clearField($_whichOneof(0)); + ViewGroup_OneOfSubGroupObjectId whichOneOfSubGroupObjectId() => _ViewGroup_OneOfSubGroupObjectIdByTag[$_whichOneof(0)]!; + void clearOneOfSubGroupObjectId() => clearField($_whichOneof(0)); @$pb.TagNumber(1) - $core.String get groupFieldId => $_getSZ(0); + $core.String get groupObjectId => $_getSZ(0); @$pb.TagNumber(1) - set groupFieldId($core.String v) { $_setString(0, v); } + set groupObjectId($core.String v) { $_setString(0, v); } @$pb.TagNumber(1) - $core.bool hasGroupFieldId() => $_has(0); + $core.bool hasGroupObjectId() => $_has(0); @$pb.TagNumber(1) - void clearGroupFieldId() => clearField(1); + void clearGroupObjectId() => clearField(1); @$pb.TagNumber(2) - $core.String get subGroupFieldId => $_getSZ(1); + $core.String get subGroupObjectId => $_getSZ(1); @$pb.TagNumber(2) - set subGroupFieldId($core.String v) { $_setString(1, v); } + set subGroupObjectId($core.String v) { $_setString(1, v); } @$pb.TagNumber(2) - $core.bool hasSubGroupFieldId() => $_has(1); + $core.bool hasSubGroupObjectId() => $_has(1); @$pb.TagNumber(2) - void clearSubGroupFieldId() => clearField(2); + void clearSubGroupObjectId() => clearField(2); } class ViewSort extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewSort', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'objectId') ..hasRequiredFields = false ; ViewSort._() : super(); factory ViewSort({ - $core.String? fieldId, + $core.String? objectId, }) { final _result = create(); - if (fieldId != null) { - _result.fieldId = fieldId; + if (objectId != null) { + _result.objectId = objectId; } return _result; } @@ -388,12 +388,146 @@ class ViewSort extends $pb.GeneratedMessage { static ViewSort? _defaultInstance; @$pb.TagNumber(1) - $core.String get fieldId => $_getSZ(0); + $core.String get objectId => $_getSZ(0); @$pb.TagNumber(1) - set fieldId($core.String v) { $_setString(0, v); } + set objectId($core.String v) { $_setString(0, v); } @$pb.TagNumber(1) - $core.bool hasFieldId() => $_has(0); + $core.bool hasObjectId() => $_has(0); @$pb.TagNumber(1) - void clearFieldId() => clearField(1); + void clearObjectId() => clearField(1); +} + +enum UpdateViewInfoPayload_OneOfFilter { + filter, + notSet +} + +enum UpdateViewInfoPayload_OneOfGroup { + group, + notSet +} + +enum UpdateViewInfoPayload_OneOfSort { + sort, + notSet +} + +class UpdateViewInfoPayload extends $pb.GeneratedMessage { + static const $core.Map<$core.int, UpdateViewInfoPayload_OneOfFilter> _UpdateViewInfoPayload_OneOfFilterByTag = { + 2 : UpdateViewInfoPayload_OneOfFilter.filter, + 0 : UpdateViewInfoPayload_OneOfFilter.notSet + }; + static const $core.Map<$core.int, UpdateViewInfoPayload_OneOfGroup> _UpdateViewInfoPayload_OneOfGroupByTag = { + 3 : UpdateViewInfoPayload_OneOfGroup.group, + 0 : UpdateViewInfoPayload_OneOfGroup.notSet + }; + static const $core.Map<$core.int, UpdateViewInfoPayload_OneOfSort> _UpdateViewInfoPayload_OneOfSortByTag = { + 4 : UpdateViewInfoPayload_OneOfSort.sort, + 0 : UpdateViewInfoPayload_OneOfSort.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateViewInfoPayload', createEmptyInstance: create) + ..oo(0, [2]) + ..oo(1, [3]) + ..oo(2, [4]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewId') + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) + ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) + ..aOM(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) + ..hasRequiredFields = false + ; + + UpdateViewInfoPayload._() : super(); + factory UpdateViewInfoPayload({ + $core.String? viewId, + ViewFilter? filter, + ViewGroup? group, + ViewSort? sort, + }) { + final _result = create(); + if (viewId != null) { + _result.viewId = viewId; + } + if (filter != null) { + _result.filter = filter; + } + if (group != null) { + _result.group = group; + } + if (sort != null) { + _result.sort = sort; + } + return _result; + } + factory UpdateViewInfoPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateViewInfoPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateViewInfoPayload clone() => UpdateViewInfoPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateViewInfoPayload copyWith(void Function(UpdateViewInfoPayload) updates) => super.copyWith((message) => updates(message as UpdateViewInfoPayload)) as UpdateViewInfoPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static UpdateViewInfoPayload create() => UpdateViewInfoPayload._(); + UpdateViewInfoPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateViewInfoPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateViewInfoPayload? _defaultInstance; + + UpdateViewInfoPayload_OneOfFilter whichOneOfFilter() => _UpdateViewInfoPayload_OneOfFilterByTag[$_whichOneof(0)]!; + void clearOneOfFilter() => clearField($_whichOneof(0)); + + UpdateViewInfoPayload_OneOfGroup whichOneOfGroup() => _UpdateViewInfoPayload_OneOfGroupByTag[$_whichOneof(1)]!; + void clearOneOfGroup() => clearField($_whichOneof(1)); + + UpdateViewInfoPayload_OneOfSort whichOneOfSort() => _UpdateViewInfoPayload_OneOfSortByTag[$_whichOneof(2)]!; + void clearOneOfSort() => clearField($_whichOneof(2)); + + @$pb.TagNumber(1) + $core.String get viewId => $_getSZ(0); + @$pb.TagNumber(1) + set viewId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasViewId() => $_has(0); + @$pb.TagNumber(1) + void clearViewId() => clearField(1); + + @$pb.TagNumber(2) + ViewFilter get filter => $_getN(1); + @$pb.TagNumber(2) + set filter(ViewFilter v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasFilter() => $_has(1); + @$pb.TagNumber(2) + void clearFilter() => clearField(2); + @$pb.TagNumber(2) + ViewFilter ensureFilter() => $_ensure(1); + + @$pb.TagNumber(3) + ViewGroup get group => $_getN(2); + @$pb.TagNumber(3) + set group(ViewGroup v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasGroup() => $_has(2); + @$pb.TagNumber(3) + void clearGroup() => clearField(3); + @$pb.TagNumber(3) + ViewGroup ensureGroup() => $_ensure(2); + + @$pb.TagNumber(4) + ViewSort get sort => $_getN(3); + @$pb.TagNumber(4) + set sort(ViewSort v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasSort() => $_has(3); + @$pb.TagNumber(4) + void clearSort() => clearField(4); + @$pb.TagNumber(4) + ViewSort ensureSort() => $_ensure(3); } diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart index 6aff03111d..679ba40e5c 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart @@ -40,33 +40,51 @@ final $typed_data.Uint8List viewExtDataDescriptor = $convert.base64Decode('CgtWa const ViewFilter$json = const { '1': 'ViewFilter', '2': const [ - const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + const {'1': 'object_id', '3': 1, '4': 1, '5': 9, '10': 'objectId'}, ], }; /// Descriptor for `ViewFilter`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewFilterDescriptor = $convert.base64Decode('CgpWaWV3RmlsdGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElk'); +final $typed_data.Uint8List viewFilterDescriptor = $convert.base64Decode('CgpWaWV3RmlsdGVyEhsKCW9iamVjdF9pZBgBIAEoCVIIb2JqZWN0SWQ='); @$core.Deprecated('Use viewGroupDescriptor instead') const ViewGroup$json = const { '1': 'ViewGroup', '2': const [ - const {'1': 'group_field_id', '3': 1, '4': 1, '5': 9, '10': 'groupFieldId'}, - const {'1': 'sub_group_field_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'subGroupFieldId'}, + const {'1': 'group_object_id', '3': 1, '4': 1, '5': 9, '10': 'groupObjectId'}, + const {'1': 'sub_group_object_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'subGroupObjectId'}, ], '8': const [ - const {'1': 'one_of_sub_group_field_id'}, + const {'1': 'one_of_sub_group_object_id'}, ], }; /// Descriptor for `ViewGroup`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewGroupDescriptor = $convert.base64Decode('CglWaWV3R3JvdXASJAoOZ3JvdXBfZmllbGRfaWQYASABKAlSDGdyb3VwRmllbGRJZBItChJzdWJfZ3JvdXBfZmllbGRfaWQYAiABKAlIAFIPc3ViR3JvdXBGaWVsZElkQhsKGW9uZV9vZl9zdWJfZ3JvdXBfZmllbGRfaWQ='); +final $typed_data.Uint8List viewGroupDescriptor = $convert.base64Decode('CglWaWV3R3JvdXASJgoPZ3JvdXBfb2JqZWN0X2lkGAEgASgJUg1ncm91cE9iamVjdElkEi8KE3N1Yl9ncm91cF9vYmplY3RfaWQYAiABKAlIAFIQc3ViR3JvdXBPYmplY3RJZEIcChpvbmVfb2Zfc3ViX2dyb3VwX29iamVjdF9pZA=='); @$core.Deprecated('Use viewSortDescriptor instead') const ViewSort$json = const { '1': 'ViewSort', '2': const [ - const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + const {'1': 'object_id', '3': 1, '4': 1, '5': 9, '10': 'objectId'}, ], }; /// Descriptor for `ViewSort`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewSortDescriptor = $convert.base64Decode('CghWaWV3U29ydBIZCghmaWVsZF9pZBgBIAEoCVIHZmllbGRJZA=='); +final $typed_data.Uint8List viewSortDescriptor = $convert.base64Decode('CghWaWV3U29ydBIbCglvYmplY3RfaWQYASABKAlSCG9iamVjdElk'); +@$core.Deprecated('Use updateViewInfoPayloadDescriptor instead') +const UpdateViewInfoPayload$json = const { + '1': 'UpdateViewInfoPayload', + '2': const [ + const {'1': 'view_id', '3': 1, '4': 1, '5': 9, '10': 'viewId'}, + const {'1': 'filter', '3': 2, '4': 1, '5': 11, '6': '.ViewFilter', '9': 0, '10': 'filter'}, + const {'1': 'group', '3': 3, '4': 1, '5': 11, '6': '.ViewGroup', '9': 1, '10': 'group'}, + const {'1': 'sort', '3': 4, '4': 1, '5': 11, '6': '.ViewSort', '9': 2, '10': 'sort'}, + ], + '8': const [ + const {'1': 'one_of_filter'}, + const {'1': 'one_of_group'}, + const {'1': 'one_of_sort'}, + ], +}; + +/// Descriptor for `UpdateViewInfoPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateViewInfoPayloadDescriptor = $convert.base64Decode('ChVVcGRhdGVWaWV3SW5mb1BheWxvYWQSFwoHdmlld19pZBgBIAEoCVIGdmlld0lkEiUKBmZpbHRlchgCIAEoCzILLlZpZXdGaWx0ZXJIAFIGZmlsdGVyEiIKBWdyb3VwGAMgASgLMgouVmlld0dyb3VwSAFSBWdyb3VwEh8KBHNvcnQYBCABKAsyCS5WaWV3U29ydEgCUgRzb3J0Qg8KDW9uZV9vZl9maWx0ZXJCDgoMb25lX29mX2dyb3VwQg0KC29uZV9vZl9zb3J0'); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart index 6df14e0a40..361ee9e10f 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart @@ -27,6 +27,7 @@ class FolderEvent extends $pb.ProtobufEnum { static const FolderEvent DuplicateView = FolderEvent._(205, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DuplicateView'); static const FolderEvent CloseView = FolderEvent._(206, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CloseView'); static const FolderEvent ReadViewInfo = FolderEvent._(207, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ReadViewInfo'); + static const FolderEvent UpdateViewInfo = FolderEvent._(208, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateViewInfo'); static const FolderEvent CopyLink = FolderEvent._(220, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CopyLink'); static const FolderEvent SetLatestView = FolderEvent._(221, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SetLatestView'); static const FolderEvent MoveFolderItem = FolderEvent._(230, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MoveFolderItem'); @@ -54,6 +55,7 @@ class FolderEvent extends $pb.ProtobufEnum { DuplicateView, CloseView, ReadViewInfo, + UpdateViewInfo, CopyLink, SetLatestView, MoveFolderItem, diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart index ca9f0650fe..8167211b6e 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart @@ -29,6 +29,7 @@ const FolderEvent$json = const { const {'1': 'DuplicateView', '2': 205}, const {'1': 'CloseView', '2': 206}, const {'1': 'ReadViewInfo', '2': 207}, + const {'1': 'UpdateViewInfo', '2': 208}, const {'1': 'CopyLink', '2': 220}, const {'1': 'SetLatestView', '2': 221}, const {'1': 'MoveFolderItem', '2': 230}, @@ -41,4 +42,4 @@ const FolderEvent$json = const { }; /// Descriptor for `FolderEvent`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARIOCglDbG9zZVZpZXcQzgESEQoMUmVhZFZpZXdJbmZvEM8BEg0KCENvcHlMaW5rENwBEhIKDVNldExhdGVzdFZpZXcQ3QESEwoOTW92ZUZvbGRlckl0ZW0Q5gESDgoJUmVhZFRyYXNoEKwCEhEKDFB1dGJhY2tUcmFzaBCtAhIQCgtEZWxldGVUcmFzaBCuAhIUCg9SZXN0b3JlQWxsVHJhc2gQrwISEwoORGVsZXRlQWxsVHJhc2gQsAI='); +final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARIOCglDbG9zZVZpZXcQzgESEQoMUmVhZFZpZXdJbmZvEM8BEhMKDlVwZGF0ZVZpZXdJbmZvENABEg0KCENvcHlMaW5rENwBEhIKDVNldExhdGVzdFZpZXcQ3QESEwoOTW92ZUZvbGRlckl0ZW0Q5gESDgoJUmVhZFRyYXNoEKwCEhEKDFB1dGJhY2tUcmFzaBCtAhIQCgtEZWxldGVUcmFzaBCuAhIUCg9SZXN0b3JlQWxsVHJhc2gQrwISEwoORGVsZXRlQWxsVHJhc2gQsAI='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pb.dart new file mode 100644 index 0000000000..9afc77d8d6 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pb.dart @@ -0,0 +1,1246 @@ +/// +// Generated code. Do not modify. +// source: field.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import 'field.pbenum.dart'; + +export 'field.pbenum.dart'; + +class Field extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Field', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') + ..e(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) + ..aOB(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'frozen') + ..aOB(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'visibility') + ..a<$core.int>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3) + ..aOB(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isPrimary') + ..hasRequiredFields = false + ; + + Field._() : super(); + factory Field({ + $core.String? id, + $core.String? name, + $core.String? desc, + FieldType? fieldType, + $core.bool? frozen, + $core.bool? visibility, + $core.int? width, + $core.bool? isPrimary, + }) { + final _result = create(); + if (id != null) { + _result.id = id; + } + if (name != null) { + _result.name = name; + } + if (desc != null) { + _result.desc = desc; + } + if (fieldType != null) { + _result.fieldType = fieldType; + } + if (frozen != null) { + _result.frozen = frozen; + } + if (visibility != null) { + _result.visibility = visibility; + } + if (width != null) { + _result.width = width; + } + if (isPrimary != null) { + _result.isPrimary = isPrimary; + } + return _result; + } + factory Field.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Field.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Field clone() => Field()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Field copyWith(void Function(Field) updates) => super.copyWith((message) => updates(message as Field)) as Field; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static Field create() => Field._(); + Field createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Field getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Field? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get name => $_getSZ(1); + @$pb.TagNumber(2) + set name($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasName() => $_has(1); + @$pb.TagNumber(2) + void clearName() => clearField(2); + + @$pb.TagNumber(3) + $core.String get desc => $_getSZ(2); + @$pb.TagNumber(3) + set desc($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasDesc() => $_has(2); + @$pb.TagNumber(3) + void clearDesc() => clearField(3); + + @$pb.TagNumber(4) + FieldType get fieldType => $_getN(3); + @$pb.TagNumber(4) + set fieldType(FieldType v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasFieldType() => $_has(3); + @$pb.TagNumber(4) + void clearFieldType() => clearField(4); + + @$pb.TagNumber(5) + $core.bool get frozen => $_getBF(4); + @$pb.TagNumber(5) + set frozen($core.bool v) { $_setBool(4, v); } + @$pb.TagNumber(5) + $core.bool hasFrozen() => $_has(4); + @$pb.TagNumber(5) + void clearFrozen() => clearField(5); + + @$pb.TagNumber(6) + $core.bool get visibility => $_getBF(5); + @$pb.TagNumber(6) + set visibility($core.bool v) { $_setBool(5, v); } + @$pb.TagNumber(6) + $core.bool hasVisibility() => $_has(5); + @$pb.TagNumber(6) + void clearVisibility() => clearField(6); + + @$pb.TagNumber(7) + $core.int get width => $_getIZ(6); + @$pb.TagNumber(7) + set width($core.int v) { $_setSignedInt32(6, v); } + @$pb.TagNumber(7) + $core.bool hasWidth() => $_has(6); + @$pb.TagNumber(7) + void clearWidth() => clearField(7); + + @$pb.TagNumber(8) + $core.bool get isPrimary => $_getBF(7); + @$pb.TagNumber(8) + set isPrimary($core.bool v) { $_setBool(7, v); } + @$pb.TagNumber(8) + $core.bool hasIsPrimary() => $_has(7); + @$pb.TagNumber(8) + void clearIsPrimary() => clearField(8); +} + +class FieldOrder extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldOrder', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..hasRequiredFields = false + ; + + FieldOrder._() : super(); + factory FieldOrder({ + $core.String? fieldId, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + return _result; + } + factory FieldOrder.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FieldOrder.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldOrder clone() => FieldOrder()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldOrder copyWith(void Function(FieldOrder) updates) => super.copyWith((message) => updates(message as FieldOrder)) as FieldOrder; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static FieldOrder create() => FieldOrder._(); + FieldOrder createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldOrder getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldOrder? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); +} + +class GridFieldChangeset extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridFieldChangeset', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..pc(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'insertedFields', $pb.PbFieldType.PM, subBuilder: IndexField.create) + ..pc(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deletedFields', $pb.PbFieldType.PM, subBuilder: FieldOrder.create) + ..pc(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'updatedFields', $pb.PbFieldType.PM, subBuilder: Field.create) + ..hasRequiredFields = false + ; + + GridFieldChangeset._() : super(); + factory GridFieldChangeset({ + $core.String? gridId, + $core.Iterable? insertedFields, + $core.Iterable? deletedFields, + $core.Iterable? updatedFields, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (insertedFields != null) { + _result.insertedFields.addAll(insertedFields); + } + if (deletedFields != null) { + _result.deletedFields.addAll(deletedFields); + } + if (updatedFields != null) { + _result.updatedFields.addAll(updatedFields); + } + return _result; + } + factory GridFieldChangeset.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GridFieldChangeset.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GridFieldChangeset clone() => GridFieldChangeset()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GridFieldChangeset copyWith(void Function(GridFieldChangeset) updates) => super.copyWith((message) => updates(message as GridFieldChangeset)) as GridFieldChangeset; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static GridFieldChangeset create() => GridFieldChangeset._(); + GridFieldChangeset createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GridFieldChangeset getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GridFieldChangeset? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + $core.List get insertedFields => $_getList(1); + + @$pb.TagNumber(3) + $core.List get deletedFields => $_getList(2); + + @$pb.TagNumber(4) + $core.List get updatedFields => $_getList(3); +} + +class IndexField extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'IndexField', createEmptyInstance: create) + ..aOM(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'field', subBuilder: Field.create) + ..a<$core.int>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'index', $pb.PbFieldType.O3) + ..hasRequiredFields = false + ; + + IndexField._() : super(); + factory IndexField({ + Field? field_1, + $core.int? index, + }) { + final _result = create(); + if (field_1 != null) { + _result.field_1 = field_1; + } + if (index != null) { + _result.index = index; + } + return _result; + } + factory IndexField.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory IndexField.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + IndexField clone() => IndexField()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + IndexField copyWith(void Function(IndexField) updates) => super.copyWith((message) => updates(message as IndexField)) as IndexField; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static IndexField create() => IndexField._(); + IndexField createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static IndexField getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static IndexField? _defaultInstance; + + @$pb.TagNumber(1) + Field get field_1 => $_getN(0); + @$pb.TagNumber(1) + set field_1(Field v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasField_1() => $_has(0); + @$pb.TagNumber(1) + void clearField_1() => clearField(1); + @$pb.TagNumber(1) + Field ensureField_1() => $_ensure(0); + + @$pb.TagNumber(2) + $core.int get index => $_getIZ(1); + @$pb.TagNumber(2) + set index($core.int v) { $_setSignedInt32(1, v); } + @$pb.TagNumber(2) + $core.bool hasIndex() => $_has(1); + @$pb.TagNumber(2) + void clearIndex() => clearField(2); +} + +enum GetEditFieldContextPayload_OneOfFieldId { + fieldId, + notSet +} + +class GetEditFieldContextPayload extends $pb.GeneratedMessage { + static const $core.Map<$core.int, GetEditFieldContextPayload_OneOfFieldId> _GetEditFieldContextPayload_OneOfFieldIdByTag = { + 2 : GetEditFieldContextPayload_OneOfFieldId.fieldId, + 0 : GetEditFieldContextPayload_OneOfFieldId.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GetEditFieldContextPayload', createEmptyInstance: create) + ..oo(0, [2]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..e(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) + ..hasRequiredFields = false + ; + + GetEditFieldContextPayload._() : super(); + factory GetEditFieldContextPayload({ + $core.String? gridId, + $core.String? fieldId, + FieldType? fieldType, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (fieldId != null) { + _result.fieldId = fieldId; + } + if (fieldType != null) { + _result.fieldType = fieldType; + } + return _result; + } + factory GetEditFieldContextPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetEditFieldContextPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetEditFieldContextPayload clone() => GetEditFieldContextPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetEditFieldContextPayload copyWith(void Function(GetEditFieldContextPayload) updates) => super.copyWith((message) => updates(message as GetEditFieldContextPayload)) as GetEditFieldContextPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static GetEditFieldContextPayload create() => GetEditFieldContextPayload._(); + GetEditFieldContextPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetEditFieldContextPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetEditFieldContextPayload? _defaultInstance; + + GetEditFieldContextPayload_OneOfFieldId whichOneOfFieldId() => _GetEditFieldContextPayload_OneOfFieldIdByTag[$_whichOneof(0)]!; + void clearOneOfFieldId() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get fieldId => $_getSZ(1); + @$pb.TagNumber(2) + set fieldId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasFieldId() => $_has(1); + @$pb.TagNumber(2) + void clearFieldId() => clearField(2); + + @$pb.TagNumber(3) + FieldType get fieldType => $_getN(2); + @$pb.TagNumber(3) + set fieldType(FieldType v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasFieldType() => $_has(2); + @$pb.TagNumber(3) + void clearFieldType() => clearField(3); +} + +class EditFieldPayload extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'EditFieldPayload', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..e(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) + ..aOB(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'createIfNotExist') + ..hasRequiredFields = false + ; + + EditFieldPayload._() : super(); + factory EditFieldPayload({ + $core.String? gridId, + $core.String? fieldId, + FieldType? fieldType, + $core.bool? createIfNotExist, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (fieldId != null) { + _result.fieldId = fieldId; + } + if (fieldType != null) { + _result.fieldType = fieldType; + } + if (createIfNotExist != null) { + _result.createIfNotExist = createIfNotExist; + } + return _result; + } + factory EditFieldPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory EditFieldPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + EditFieldPayload clone() => EditFieldPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + EditFieldPayload copyWith(void Function(EditFieldPayload) updates) => super.copyWith((message) => updates(message as EditFieldPayload)) as EditFieldPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static EditFieldPayload create() => EditFieldPayload._(); + EditFieldPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static EditFieldPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static EditFieldPayload? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get fieldId => $_getSZ(1); + @$pb.TagNumber(2) + set fieldId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasFieldId() => $_has(1); + @$pb.TagNumber(2) + void clearFieldId() => clearField(2); + + @$pb.TagNumber(3) + FieldType get fieldType => $_getN(2); + @$pb.TagNumber(3) + set fieldType(FieldType v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasFieldType() => $_has(2); + @$pb.TagNumber(3) + void clearFieldType() => clearField(3); + + @$pb.TagNumber(4) + $core.bool get createIfNotExist => $_getBF(3); + @$pb.TagNumber(4) + set createIfNotExist($core.bool v) { $_setBool(3, v); } + @$pb.TagNumber(4) + $core.bool hasCreateIfNotExist() => $_has(3); + @$pb.TagNumber(4) + void clearCreateIfNotExist() => clearField(4); +} + +class FieldTypeOptionContext extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldTypeOptionContext', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridField', subBuilder: Field.create) + ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) + ..hasRequiredFields = false + ; + + FieldTypeOptionContext._() : super(); + factory FieldTypeOptionContext({ + $core.String? gridId, + Field? gridField, + $core.List<$core.int>? typeOptionData, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (gridField != null) { + _result.gridField = gridField; + } + if (typeOptionData != null) { + _result.typeOptionData = typeOptionData; + } + return _result; + } + factory FieldTypeOptionContext.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FieldTypeOptionContext.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldTypeOptionContext clone() => FieldTypeOptionContext()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldTypeOptionContext copyWith(void Function(FieldTypeOptionContext) updates) => super.copyWith((message) => updates(message as FieldTypeOptionContext)) as FieldTypeOptionContext; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static FieldTypeOptionContext create() => FieldTypeOptionContext._(); + FieldTypeOptionContext createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldTypeOptionContext getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldTypeOptionContext? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + Field get gridField => $_getN(1); + @$pb.TagNumber(2) + set gridField(Field v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasGridField() => $_has(1); + @$pb.TagNumber(2) + void clearGridField() => clearField(2); + @$pb.TagNumber(2) + Field ensureGridField() => $_ensure(1); + + @$pb.TagNumber(3) + $core.List<$core.int> get typeOptionData => $_getN(2); + @$pb.TagNumber(3) + set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } + @$pb.TagNumber(3) + $core.bool hasTypeOptionData() => $_has(2); + @$pb.TagNumber(3) + void clearTypeOptionData() => clearField(3); +} + +class FieldTypeOptionData extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldTypeOptionData', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'field', subBuilder: Field.create) + ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) + ..hasRequiredFields = false + ; + + FieldTypeOptionData._() : super(); + factory FieldTypeOptionData({ + $core.String? gridId, + Field? field_2, + $core.List<$core.int>? typeOptionData, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (field_2 != null) { + _result.field_2 = field_2; + } + if (typeOptionData != null) { + _result.typeOptionData = typeOptionData; + } + return _result; + } + factory FieldTypeOptionData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FieldTypeOptionData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldTypeOptionData clone() => FieldTypeOptionData()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldTypeOptionData copyWith(void Function(FieldTypeOptionData) updates) => super.copyWith((message) => updates(message as FieldTypeOptionData)) as FieldTypeOptionData; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static FieldTypeOptionData create() => FieldTypeOptionData._(); + FieldTypeOptionData createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldTypeOptionData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldTypeOptionData? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + Field get field_2 => $_getN(1); + @$pb.TagNumber(2) + set field_2(Field v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasField_2() => $_has(1); + @$pb.TagNumber(2) + void clearField_2() => clearField(2); + @$pb.TagNumber(2) + Field ensureField_2() => $_ensure(1); + + @$pb.TagNumber(3) + $core.List<$core.int> get typeOptionData => $_getN(2); + @$pb.TagNumber(3) + set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } + @$pb.TagNumber(3) + $core.bool hasTypeOptionData() => $_has(2); + @$pb.TagNumber(3) + void clearTypeOptionData() => clearField(3); +} + +class RepeatedField extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedField', createEmptyInstance: create) + ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: Field.create) + ..hasRequiredFields = false + ; + + RepeatedField._() : super(); + factory RepeatedField({ + $core.Iterable? items, + }) { + final _result = create(); + if (items != null) { + _result.items.addAll(items); + } + return _result; + } + factory RepeatedField.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory RepeatedField.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + RepeatedField clone() => RepeatedField()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + RepeatedField copyWith(void Function(RepeatedField) updates) => super.copyWith((message) => updates(message as RepeatedField)) as RepeatedField; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static RepeatedField create() => RepeatedField._(); + RepeatedField createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static RepeatedField getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RepeatedField? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get items => $_getList(0); +} + +class RepeatedFieldOrder extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedFieldOrder', createEmptyInstance: create) + ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: FieldOrder.create) + ..hasRequiredFields = false + ; + + RepeatedFieldOrder._() : super(); + factory RepeatedFieldOrder({ + $core.Iterable? items, + }) { + final _result = create(); + if (items != null) { + _result.items.addAll(items); + } + return _result; + } + factory RepeatedFieldOrder.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory RepeatedFieldOrder.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + RepeatedFieldOrder clone() => RepeatedFieldOrder()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + RepeatedFieldOrder copyWith(void Function(RepeatedFieldOrder) updates) => super.copyWith((message) => updates(message as RepeatedFieldOrder)) as RepeatedFieldOrder; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static RepeatedFieldOrder create() => RepeatedFieldOrder._(); + RepeatedFieldOrder createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static RepeatedFieldOrder getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RepeatedFieldOrder? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get items => $_getList(0); +} + +enum InsertFieldPayload_OneOfStartFieldId { + startFieldId, + notSet +} + +class InsertFieldPayload extends $pb.GeneratedMessage { + static const $core.Map<$core.int, InsertFieldPayload_OneOfStartFieldId> _InsertFieldPayload_OneOfStartFieldIdByTag = { + 4 : InsertFieldPayload_OneOfStartFieldId.startFieldId, + 0 : InsertFieldPayload_OneOfStartFieldId.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'InsertFieldPayload', createEmptyInstance: create) + ..oo(0, [4]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'field', subBuilder: Field.create) + ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) + ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'startFieldId') + ..hasRequiredFields = false + ; + + InsertFieldPayload._() : super(); + factory InsertFieldPayload({ + $core.String? gridId, + Field? field_2, + $core.List<$core.int>? typeOptionData, + $core.String? startFieldId, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (field_2 != null) { + _result.field_2 = field_2; + } + if (typeOptionData != null) { + _result.typeOptionData = typeOptionData; + } + if (startFieldId != null) { + _result.startFieldId = startFieldId; + } + return _result; + } + factory InsertFieldPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory InsertFieldPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + InsertFieldPayload clone() => InsertFieldPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + InsertFieldPayload copyWith(void Function(InsertFieldPayload) updates) => super.copyWith((message) => updates(message as InsertFieldPayload)) as InsertFieldPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static InsertFieldPayload create() => InsertFieldPayload._(); + InsertFieldPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static InsertFieldPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static InsertFieldPayload? _defaultInstance; + + InsertFieldPayload_OneOfStartFieldId whichOneOfStartFieldId() => _InsertFieldPayload_OneOfStartFieldIdByTag[$_whichOneof(0)]!; + void clearOneOfStartFieldId() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + Field get field_2 => $_getN(1); + @$pb.TagNumber(2) + set field_2(Field v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasField_2() => $_has(1); + @$pb.TagNumber(2) + void clearField_2() => clearField(2); + @$pb.TagNumber(2) + Field ensureField_2() => $_ensure(1); + + @$pb.TagNumber(3) + $core.List<$core.int> get typeOptionData => $_getN(2); + @$pb.TagNumber(3) + set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } + @$pb.TagNumber(3) + $core.bool hasTypeOptionData() => $_has(2); + @$pb.TagNumber(3) + void clearTypeOptionData() => clearField(3); + + @$pb.TagNumber(4) + $core.String get startFieldId => $_getSZ(3); + @$pb.TagNumber(4) + set startFieldId($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasStartFieldId() => $_has(3); + @$pb.TagNumber(4) + void clearStartFieldId() => clearField(4); +} + +class UpdateFieldTypeOptionPayload extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateFieldTypeOptionPayload', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) + ..hasRequiredFields = false + ; + + UpdateFieldTypeOptionPayload._() : super(); + factory UpdateFieldTypeOptionPayload({ + $core.String? gridId, + $core.String? fieldId, + $core.List<$core.int>? typeOptionData, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (fieldId != null) { + _result.fieldId = fieldId; + } + if (typeOptionData != null) { + _result.typeOptionData = typeOptionData; + } + return _result; + } + factory UpdateFieldTypeOptionPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory UpdateFieldTypeOptionPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + UpdateFieldTypeOptionPayload clone() => UpdateFieldTypeOptionPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + UpdateFieldTypeOptionPayload copyWith(void Function(UpdateFieldTypeOptionPayload) updates) => super.copyWith((message) => updates(message as UpdateFieldTypeOptionPayload)) as UpdateFieldTypeOptionPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static UpdateFieldTypeOptionPayload create() => UpdateFieldTypeOptionPayload._(); + UpdateFieldTypeOptionPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static UpdateFieldTypeOptionPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static UpdateFieldTypeOptionPayload? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get fieldId => $_getSZ(1); + @$pb.TagNumber(2) + set fieldId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasFieldId() => $_has(1); + @$pb.TagNumber(2) + void clearFieldId() => clearField(2); + + @$pb.TagNumber(3) + $core.List<$core.int> get typeOptionData => $_getN(2); + @$pb.TagNumber(3) + set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } + @$pb.TagNumber(3) + $core.bool hasTypeOptionData() => $_has(2); + @$pb.TagNumber(3) + void clearTypeOptionData() => clearField(3); +} + +class QueryFieldPayload extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryFieldPayload', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldOrders', subBuilder: RepeatedFieldOrder.create) + ..hasRequiredFields = false + ; + + QueryFieldPayload._() : super(); + factory QueryFieldPayload({ + $core.String? gridId, + RepeatedFieldOrder? fieldOrders, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (fieldOrders != null) { + _result.fieldOrders = fieldOrders; + } + return _result; + } + factory QueryFieldPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory QueryFieldPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + QueryFieldPayload clone() => QueryFieldPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + QueryFieldPayload copyWith(void Function(QueryFieldPayload) updates) => super.copyWith((message) => updates(message as QueryFieldPayload)) as QueryFieldPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static QueryFieldPayload create() => QueryFieldPayload._(); + QueryFieldPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static QueryFieldPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static QueryFieldPayload? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + RepeatedFieldOrder get fieldOrders => $_getN(1); + @$pb.TagNumber(2) + set fieldOrders(RepeatedFieldOrder v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasFieldOrders() => $_has(1); + @$pb.TagNumber(2) + void clearFieldOrders() => clearField(2); + @$pb.TagNumber(2) + RepeatedFieldOrder ensureFieldOrders() => $_ensure(1); +} + +enum FieldChangesetPayload_OneOfName { + name, + notSet +} + +enum FieldChangesetPayload_OneOfDesc { + desc, + notSet +} + +enum FieldChangesetPayload_OneOfFieldType { + fieldType, + notSet +} + +enum FieldChangesetPayload_OneOfFrozen { + frozen, + notSet +} + +enum FieldChangesetPayload_OneOfVisibility { + visibility, + notSet +} + +enum FieldChangesetPayload_OneOfWidth { + width, + notSet +} + +enum FieldChangesetPayload_OneOfTypeOptionData { + typeOptionData, + notSet +} + +class FieldChangesetPayload extends $pb.GeneratedMessage { + static const $core.Map<$core.int, FieldChangesetPayload_OneOfName> _FieldChangesetPayload_OneOfNameByTag = { + 3 : FieldChangesetPayload_OneOfName.name, + 0 : FieldChangesetPayload_OneOfName.notSet + }; + static const $core.Map<$core.int, FieldChangesetPayload_OneOfDesc> _FieldChangesetPayload_OneOfDescByTag = { + 4 : FieldChangesetPayload_OneOfDesc.desc, + 0 : FieldChangesetPayload_OneOfDesc.notSet + }; + static const $core.Map<$core.int, FieldChangesetPayload_OneOfFieldType> _FieldChangesetPayload_OneOfFieldTypeByTag = { + 5 : FieldChangesetPayload_OneOfFieldType.fieldType, + 0 : FieldChangesetPayload_OneOfFieldType.notSet + }; + static const $core.Map<$core.int, FieldChangesetPayload_OneOfFrozen> _FieldChangesetPayload_OneOfFrozenByTag = { + 6 : FieldChangesetPayload_OneOfFrozen.frozen, + 0 : FieldChangesetPayload_OneOfFrozen.notSet + }; + static const $core.Map<$core.int, FieldChangesetPayload_OneOfVisibility> _FieldChangesetPayload_OneOfVisibilityByTag = { + 7 : FieldChangesetPayload_OneOfVisibility.visibility, + 0 : FieldChangesetPayload_OneOfVisibility.notSet + }; + static const $core.Map<$core.int, FieldChangesetPayload_OneOfWidth> _FieldChangesetPayload_OneOfWidthByTag = { + 8 : FieldChangesetPayload_OneOfWidth.width, + 0 : FieldChangesetPayload_OneOfWidth.notSet + }; + static const $core.Map<$core.int, FieldChangesetPayload_OneOfTypeOptionData> _FieldChangesetPayload_OneOfTypeOptionDataByTag = { + 9 : FieldChangesetPayload_OneOfTypeOptionData.typeOptionData, + 0 : FieldChangesetPayload_OneOfTypeOptionData.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldChangesetPayload', createEmptyInstance: create) + ..oo(0, [3]) + ..oo(1, [4]) + ..oo(2, [5]) + ..oo(3, [6]) + ..oo(4, [7]) + ..oo(5, [8]) + ..oo(6, [9]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') + ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') + ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) + ..aOB(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'frozen') + ..aOB(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'visibility') + ..a<$core.int>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3) + ..a<$core.List<$core.int>>(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) + ..hasRequiredFields = false + ; + + FieldChangesetPayload._() : super(); + factory FieldChangesetPayload({ + $core.String? fieldId, + $core.String? gridId, + $core.String? name, + $core.String? desc, + FieldType? fieldType, + $core.bool? frozen, + $core.bool? visibility, + $core.int? width, + $core.List<$core.int>? typeOptionData, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + if (gridId != null) { + _result.gridId = gridId; + } + if (name != null) { + _result.name = name; + } + if (desc != null) { + _result.desc = desc; + } + if (fieldType != null) { + _result.fieldType = fieldType; + } + if (frozen != null) { + _result.frozen = frozen; + } + if (visibility != null) { + _result.visibility = visibility; + } + if (width != null) { + _result.width = width; + } + if (typeOptionData != null) { + _result.typeOptionData = typeOptionData; + } + return _result; + } + factory FieldChangesetPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory FieldChangesetPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + FieldChangesetPayload clone() => FieldChangesetPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + FieldChangesetPayload copyWith(void Function(FieldChangesetPayload) updates) => super.copyWith((message) => updates(message as FieldChangesetPayload)) as FieldChangesetPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static FieldChangesetPayload create() => FieldChangesetPayload._(); + FieldChangesetPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static FieldChangesetPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldChangesetPayload? _defaultInstance; + + FieldChangesetPayload_OneOfName whichOneOfName() => _FieldChangesetPayload_OneOfNameByTag[$_whichOneof(0)]!; + void clearOneOfName() => clearField($_whichOneof(0)); + + FieldChangesetPayload_OneOfDesc whichOneOfDesc() => _FieldChangesetPayload_OneOfDescByTag[$_whichOneof(1)]!; + void clearOneOfDesc() => clearField($_whichOneof(1)); + + FieldChangesetPayload_OneOfFieldType whichOneOfFieldType() => _FieldChangesetPayload_OneOfFieldTypeByTag[$_whichOneof(2)]!; + void clearOneOfFieldType() => clearField($_whichOneof(2)); + + FieldChangesetPayload_OneOfFrozen whichOneOfFrozen() => _FieldChangesetPayload_OneOfFrozenByTag[$_whichOneof(3)]!; + void clearOneOfFrozen() => clearField($_whichOneof(3)); + + FieldChangesetPayload_OneOfVisibility whichOneOfVisibility() => _FieldChangesetPayload_OneOfVisibilityByTag[$_whichOneof(4)]!; + void clearOneOfVisibility() => clearField($_whichOneof(4)); + + FieldChangesetPayload_OneOfWidth whichOneOfWidth() => _FieldChangesetPayload_OneOfWidthByTag[$_whichOneof(5)]!; + void clearOneOfWidth() => clearField($_whichOneof(5)); + + FieldChangesetPayload_OneOfTypeOptionData whichOneOfTypeOptionData() => _FieldChangesetPayload_OneOfTypeOptionDataByTag[$_whichOneof(6)]!; + void clearOneOfTypeOptionData() => clearField($_whichOneof(6)); + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get gridId => $_getSZ(1); + @$pb.TagNumber(2) + set gridId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasGridId() => $_has(1); + @$pb.TagNumber(2) + void clearGridId() => clearField(2); + + @$pb.TagNumber(3) + $core.String get name => $_getSZ(2); + @$pb.TagNumber(3) + set name($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasName() => $_has(2); + @$pb.TagNumber(3) + void clearName() => clearField(3); + + @$pb.TagNumber(4) + $core.String get desc => $_getSZ(3); + @$pb.TagNumber(4) + set desc($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasDesc() => $_has(3); + @$pb.TagNumber(4) + void clearDesc() => clearField(4); + + @$pb.TagNumber(5) + FieldType get fieldType => $_getN(4); + @$pb.TagNumber(5) + set fieldType(FieldType v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasFieldType() => $_has(4); + @$pb.TagNumber(5) + void clearFieldType() => clearField(5); + + @$pb.TagNumber(6) + $core.bool get frozen => $_getBF(5); + @$pb.TagNumber(6) + set frozen($core.bool v) { $_setBool(5, v); } + @$pb.TagNumber(6) + $core.bool hasFrozen() => $_has(5); + @$pb.TagNumber(6) + void clearFrozen() => clearField(6); + + @$pb.TagNumber(7) + $core.bool get visibility => $_getBF(6); + @$pb.TagNumber(7) + set visibility($core.bool v) { $_setBool(6, v); } + @$pb.TagNumber(7) + $core.bool hasVisibility() => $_has(6); + @$pb.TagNumber(7) + void clearVisibility() => clearField(7); + + @$pb.TagNumber(8) + $core.int get width => $_getIZ(7); + @$pb.TagNumber(8) + set width($core.int v) { $_setSignedInt32(7, v); } + @$pb.TagNumber(8) + $core.bool hasWidth() => $_has(7); + @$pb.TagNumber(8) + void clearWidth() => clearField(8); + + @$pb.TagNumber(9) + $core.List<$core.int> get typeOptionData => $_getN(8); + @$pb.TagNumber(9) + set typeOptionData($core.List<$core.int> v) { $_setBytes(8, v); } + @$pb.TagNumber(9) + $core.bool hasTypeOptionData() => $_has(8); + @$pb.TagNumber(9) + void clearTypeOptionData() => clearField(9); +} + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbenum.dart new file mode 100644 index 0000000000..974d4dfbcc --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbenum.dart @@ -0,0 +1,36 @@ +/// +// Generated code. Do not modify. +// source: field.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +// ignore_for_file: UNDEFINED_SHOWN_NAME +import 'dart:core' as $core; +import 'package:protobuf/protobuf.dart' as $pb; + +class FieldType extends $pb.ProtobufEnum { + static const FieldType RichText = FieldType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RichText'); + static const FieldType Number = FieldType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Number'); + static const FieldType DateTime = FieldType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DateTime'); + static const FieldType SingleSelect = FieldType._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SingleSelect'); + static const FieldType MultiSelect = FieldType._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MultiSelect'); + static const FieldType Checkbox = FieldType._(5, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Checkbox'); + static const FieldType URL = FieldType._(6, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'URL'); + + static const $core.List values = [ + RichText, + Number, + DateTime, + SingleSelect, + MultiSelect, + Checkbox, + URL, + ]; + + static final $core.Map<$core.int, FieldType> _byValue = $pb.ProtobufEnum.initByValue(values); + static FieldType? valueOf($core.int value) => _byValue[value]; + + const FieldType._($core.int v, $core.String n) : super(v, n); +} + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbjson.dart new file mode 100644 index 0000000000..ced3e31ffd --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbjson.dart @@ -0,0 +1,215 @@ +/// +// Generated code. Do not modify. +// source: field.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use fieldTypeDescriptor instead') +const FieldType$json = const { + '1': 'FieldType', + '2': const [ + const {'1': 'RichText', '2': 0}, + const {'1': 'Number', '2': 1}, + const {'1': 'DateTime', '2': 2}, + const {'1': 'SingleSelect', '2': 3}, + const {'1': 'MultiSelect', '2': 4}, + const {'1': 'Checkbox', '2': 5}, + const {'1': 'URL', '2': 6}, + ], +}; + +/// Descriptor for `FieldType`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List fieldTypeDescriptor = $convert.base64Decode('CglGaWVsZFR5cGUSDAoIUmljaFRleHQQABIKCgZOdW1iZXIQARIMCghEYXRlVGltZRACEhAKDFNpbmdsZVNlbGVjdBADEg8KC011bHRpU2VsZWN0EAQSDAoIQ2hlY2tib3gQBRIHCgNVUkwQBg=='); +@$core.Deprecated('Use fieldDescriptor instead') +const Field$json = const { + '1': 'Field', + '2': const [ + const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, + const {'1': 'desc', '3': 3, '4': 1, '5': 9, '10': 'desc'}, + const {'1': 'field_type', '3': 4, '4': 1, '5': 14, '6': '.FieldType', '10': 'fieldType'}, + const {'1': 'frozen', '3': 5, '4': 1, '5': 8, '10': 'frozen'}, + const {'1': 'visibility', '3': 6, '4': 1, '5': 8, '10': 'visibility'}, + const {'1': 'width', '3': 7, '4': 1, '5': 5, '10': 'width'}, + const {'1': 'is_primary', '3': 8, '4': 1, '5': 8, '10': 'isPrimary'}, + ], +}; + +/// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode('CgVGaWVsZBIOCgJpZBgBIAEoCVICaWQSEgoEbmFtZRgCIAEoCVIEbmFtZRISCgRkZXNjGAMgASgJUgRkZXNjEikKCmZpZWxkX3R5cGUYBCABKA4yCi5GaWVsZFR5cGVSCWZpZWxkVHlwZRIWCgZmcm96ZW4YBSABKAhSBmZyb3plbhIeCgp2aXNpYmlsaXR5GAYgASgIUgp2aXNpYmlsaXR5EhQKBXdpZHRoGAcgASgFUgV3aWR0aBIdCgppc19wcmltYXJ5GAggASgIUglpc1ByaW1hcnk='); +@$core.Deprecated('Use fieldOrderDescriptor instead') +const FieldOrder$json = const { + '1': 'FieldOrder', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + ], +}; + +/// Descriptor for `FieldOrder`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldOrderDescriptor = $convert.base64Decode('CgpGaWVsZE9yZGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElk'); +@$core.Deprecated('Use gridFieldChangesetDescriptor instead') +const GridFieldChangeset$json = const { + '1': 'GridFieldChangeset', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'inserted_fields', '3': 2, '4': 3, '5': 11, '6': '.IndexField', '10': 'insertedFields'}, + const {'1': 'deleted_fields', '3': 3, '4': 3, '5': 11, '6': '.FieldOrder', '10': 'deletedFields'}, + const {'1': 'updated_fields', '3': 4, '4': 3, '5': 11, '6': '.Field', '10': 'updatedFields'}, + ], +}; + +/// Descriptor for `GridFieldChangeset`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List gridFieldChangesetDescriptor = $convert.base64Decode('ChJHcmlkRmllbGRDaGFuZ2VzZXQSFwoHZ3JpZF9pZBgBIAEoCVIGZ3JpZElkEjQKD2luc2VydGVkX2ZpZWxkcxgCIAMoCzILLkluZGV4RmllbGRSDmluc2VydGVkRmllbGRzEjIKDmRlbGV0ZWRfZmllbGRzGAMgAygLMgsuRmllbGRPcmRlclINZGVsZXRlZEZpZWxkcxItCg51cGRhdGVkX2ZpZWxkcxgEIAMoCzIGLkZpZWxkUg11cGRhdGVkRmllbGRz'); +@$core.Deprecated('Use indexFieldDescriptor instead') +const IndexField$json = const { + '1': 'IndexField', + '2': const [ + const {'1': 'field', '3': 1, '4': 1, '5': 11, '6': '.Field', '10': 'field'}, + const {'1': 'index', '3': 2, '4': 1, '5': 5, '10': 'index'}, + ], +}; + +/// Descriptor for `IndexField`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List indexFieldDescriptor = $convert.base64Decode('CgpJbmRleEZpZWxkEhwKBWZpZWxkGAEgASgLMgYuRmllbGRSBWZpZWxkEhQKBWluZGV4GAIgASgFUgVpbmRleA=='); +@$core.Deprecated('Use getEditFieldContextPayloadDescriptor instead') +const GetEditFieldContextPayload$json = const { + '1': 'GetEditFieldContextPayload', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'field_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'fieldId'}, + const {'1': 'field_type', '3': 3, '4': 1, '5': 14, '6': '.FieldType', '10': 'fieldType'}, + ], + '8': const [ + const {'1': 'one_of_field_id'}, + ], +}; + +/// Descriptor for `GetEditFieldContextPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getEditFieldContextPayloadDescriptor = $convert.base64Decode('ChpHZXRFZGl0RmllbGRDb250ZXh0UGF5bG9hZBIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSGwoIZmllbGRfaWQYAiABKAlIAFIHZmllbGRJZBIpCgpmaWVsZF90eXBlGAMgASgOMgouRmllbGRUeXBlUglmaWVsZFR5cGVCEQoPb25lX29mX2ZpZWxkX2lk'); +@$core.Deprecated('Use editFieldPayloadDescriptor instead') +const EditFieldPayload$json = const { + '1': 'EditFieldPayload', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'field_id', '3': 2, '4': 1, '5': 9, '10': 'fieldId'}, + const {'1': 'field_type', '3': 3, '4': 1, '5': 14, '6': '.FieldType', '10': 'fieldType'}, + const {'1': 'create_if_not_exist', '3': 4, '4': 1, '5': 8, '10': 'createIfNotExist'}, + ], +}; + +/// Descriptor for `EditFieldPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List editFieldPayloadDescriptor = $convert.base64Decode('ChBFZGl0RmllbGRQYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIZCghmaWVsZF9pZBgCIAEoCVIHZmllbGRJZBIpCgpmaWVsZF90eXBlGAMgASgOMgouRmllbGRUeXBlUglmaWVsZFR5cGUSLQoTY3JlYXRlX2lmX25vdF9leGlzdBgEIAEoCFIQY3JlYXRlSWZOb3RFeGlzdA=='); +@$core.Deprecated('Use fieldTypeOptionContextDescriptor instead') +const FieldTypeOptionContext$json = const { + '1': 'FieldTypeOptionContext', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'grid_field', '3': 2, '4': 1, '5': 11, '6': '.Field', '10': 'gridField'}, + const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, + ], +}; + +/// Descriptor for `FieldTypeOptionContext`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldTypeOptionContextDescriptor = $convert.base64Decode('ChZGaWVsZFR5cGVPcHRpb25Db250ZXh0EhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIlCgpncmlkX2ZpZWxkGAIgASgLMgYuRmllbGRSCWdyaWRGaWVsZBIoChB0eXBlX29wdGlvbl9kYXRhGAMgASgMUg50eXBlT3B0aW9uRGF0YQ=='); +@$core.Deprecated('Use fieldTypeOptionDataDescriptor instead') +const FieldTypeOptionData$json = const { + '1': 'FieldTypeOptionData', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'field', '3': 2, '4': 1, '5': 11, '6': '.Field', '10': 'field'}, + const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, + ], +}; + +/// Descriptor for `FieldTypeOptionData`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldTypeOptionDataDescriptor = $convert.base64Decode('ChNGaWVsZFR5cGVPcHRpb25EYXRhEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIcCgVmaWVsZBgCIAEoCzIGLkZpZWxkUgVmaWVsZBIoChB0eXBlX29wdGlvbl9kYXRhGAMgASgMUg50eXBlT3B0aW9uRGF0YQ=='); +@$core.Deprecated('Use repeatedFieldDescriptor instead') +const RepeatedField$json = const { + '1': 'RepeatedField', + '2': const [ + const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.Field', '10': 'items'}, + ], +}; + +/// Descriptor for `RepeatedField`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List repeatedFieldDescriptor = $convert.base64Decode('Cg1SZXBlYXRlZEZpZWxkEhwKBWl0ZW1zGAEgAygLMgYuRmllbGRSBWl0ZW1z'); +@$core.Deprecated('Use repeatedFieldOrderDescriptor instead') +const RepeatedFieldOrder$json = const { + '1': 'RepeatedFieldOrder', + '2': const [ + const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.FieldOrder', '10': 'items'}, + ], +}; + +/// Descriptor for `RepeatedFieldOrder`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List repeatedFieldOrderDescriptor = $convert.base64Decode('ChJSZXBlYXRlZEZpZWxkT3JkZXISIQoFaXRlbXMYASADKAsyCy5GaWVsZE9yZGVyUgVpdGVtcw=='); +@$core.Deprecated('Use insertFieldPayloadDescriptor instead') +const InsertFieldPayload$json = const { + '1': 'InsertFieldPayload', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'field', '3': 2, '4': 1, '5': 11, '6': '.Field', '10': 'field'}, + const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, + const {'1': 'start_field_id', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'startFieldId'}, + ], + '8': const [ + const {'1': 'one_of_start_field_id'}, + ], +}; + +/// Descriptor for `InsertFieldPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List insertFieldPayloadDescriptor = $convert.base64Decode('ChJJbnNlcnRGaWVsZFBheWxvYWQSFwoHZ3JpZF9pZBgBIAEoCVIGZ3JpZElkEhwKBWZpZWxkGAIgASgLMgYuRmllbGRSBWZpZWxkEigKEHR5cGVfb3B0aW9uX2RhdGEYAyABKAxSDnR5cGVPcHRpb25EYXRhEiYKDnN0YXJ0X2ZpZWxkX2lkGAQgASgJSABSDHN0YXJ0RmllbGRJZEIXChVvbmVfb2Zfc3RhcnRfZmllbGRfaWQ='); +@$core.Deprecated('Use updateFieldTypeOptionPayloadDescriptor instead') +const UpdateFieldTypeOptionPayload$json = const { + '1': 'UpdateFieldTypeOptionPayload', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'field_id', '3': 2, '4': 1, '5': 9, '10': 'fieldId'}, + const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, + ], +}; + +/// Descriptor for `UpdateFieldTypeOptionPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List updateFieldTypeOptionPayloadDescriptor = $convert.base64Decode('ChxVcGRhdGVGaWVsZFR5cGVPcHRpb25QYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIZCghmaWVsZF9pZBgCIAEoCVIHZmllbGRJZBIoChB0eXBlX29wdGlvbl9kYXRhGAMgASgMUg50eXBlT3B0aW9uRGF0YQ=='); +@$core.Deprecated('Use queryFieldPayloadDescriptor instead') +const QueryFieldPayload$json = const { + '1': 'QueryFieldPayload', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'field_orders', '3': 2, '4': 1, '5': 11, '6': '.RepeatedFieldOrder', '10': 'fieldOrders'}, + ], +}; + +/// Descriptor for `QueryFieldPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List queryFieldPayloadDescriptor = $convert.base64Decode('ChFRdWVyeUZpZWxkUGF5bG9hZBIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSNgoMZmllbGRfb3JkZXJzGAIgASgLMhMuUmVwZWF0ZWRGaWVsZE9yZGVyUgtmaWVsZE9yZGVycw=='); +@$core.Deprecated('Use fieldChangesetPayloadDescriptor instead') +const FieldChangesetPayload$json = const { + '1': 'FieldChangesetPayload', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, + const {'1': 'grid_id', '3': 2, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'name', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'name'}, + const {'1': 'desc', '3': 4, '4': 1, '5': 9, '9': 1, '10': 'desc'}, + const {'1': 'field_type', '3': 5, '4': 1, '5': 14, '6': '.FieldType', '9': 2, '10': 'fieldType'}, + const {'1': 'frozen', '3': 6, '4': 1, '5': 8, '9': 3, '10': 'frozen'}, + const {'1': 'visibility', '3': 7, '4': 1, '5': 8, '9': 4, '10': 'visibility'}, + const {'1': 'width', '3': 8, '4': 1, '5': 5, '9': 5, '10': 'width'}, + const {'1': 'type_option_data', '3': 9, '4': 1, '5': 12, '9': 6, '10': 'typeOptionData'}, + ], + '8': const [ + const {'1': 'one_of_name'}, + const {'1': 'one_of_desc'}, + const {'1': 'one_of_field_type'}, + const {'1': 'one_of_frozen'}, + const {'1': 'one_of_visibility'}, + const {'1': 'one_of_width'}, + const {'1': 'one_of_type_option_data'}, + ], +}; + +/// Descriptor for `FieldChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldChangesetPayloadDescriptor = $convert.base64Decode('ChVGaWVsZENoYW5nZXNldFBheWxvYWQSGQoIZmllbGRfaWQYASABKAlSB2ZpZWxkSWQSFwoHZ3JpZF9pZBgCIAEoCVIGZ3JpZElkEhQKBG5hbWUYAyABKAlIAFIEbmFtZRIUCgRkZXNjGAQgASgJSAFSBGRlc2MSKwoKZmllbGRfdHlwZRgFIAEoDjIKLkZpZWxkVHlwZUgCUglmaWVsZFR5cGUSGAoGZnJvemVuGAYgASgISANSBmZyb3plbhIgCgp2aXNpYmlsaXR5GAcgASgISARSCnZpc2liaWxpdHkSFgoFd2lkdGgYCCABKAVIBVIFd2lkdGgSKgoQdHlwZV9vcHRpb25fZGF0YRgJIAEoDEgGUg50eXBlT3B0aW9uRGF0YUINCgtvbmVfb2ZfbmFtZUINCgtvbmVfb2ZfZGVzY0ITChFvbmVfb2ZfZmllbGRfdHlwZUIPCg1vbmVfb2ZfZnJvemVuQhMKEW9uZV9vZl92aXNpYmlsaXR5Qg4KDG9uZV9vZl93aWR0aEIZChdvbmVfb2ZfdHlwZV9vcHRpb25fZGF0YQ=='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbserver.dart new file mode 100644 index 0000000000..56e1ca44de --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/field.pbserver.dart @@ -0,0 +1,9 @@ +/// +// Generated code. Do not modify. +// source: field.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +export 'field.pb.dart'; + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart index 87f9036c88..e56d2cbde8 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart @@ -9,6 +9,8 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; +import 'field.pb.dart' as $0; + import 'grid.pbenum.dart'; export 'grid.pbenum.dart'; @@ -16,7 +18,7 @@ export 'grid.pbenum.dart'; class Grid extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Grid', createEmptyInstance: create) ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..pc(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldOrders', $pb.PbFieldType.PM, subBuilder: FieldOrder.create) + ..pc<$0.FieldOrder>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldOrders', $pb.PbFieldType.PM, subBuilder: $0.FieldOrder.create) ..pc(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blockOrders', $pb.PbFieldType.PM, subBuilder: GridBlockOrder.create) ..hasRequiredFields = false ; @@ -24,7 +26,7 @@ class Grid extends $pb.GeneratedMessage { Grid._() : super(); factory Grid({ $core.String? id, - $core.Iterable? fieldOrders, + $core.Iterable<$0.FieldOrder>? fieldOrders, $core.Iterable? blockOrders, }) { final _result = create(); @@ -70,751 +72,12 @@ class Grid extends $pb.GeneratedMessage { void clearId() => clearField(1); @$pb.TagNumber(2) - $core.List get fieldOrders => $_getList(1); + $core.List<$0.FieldOrder> get fieldOrders => $_getList(1); @$pb.TagNumber(3) $core.List get blockOrders => $_getList(2); } -class Field extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Field', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') - ..e(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) - ..aOB(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'frozen') - ..aOB(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'visibility') - ..a<$core.int>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3) - ..aOB(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isPrimary') - ..hasRequiredFields = false - ; - - Field._() : super(); - factory Field({ - $core.String? id, - $core.String? name, - $core.String? desc, - FieldType? fieldType, - $core.bool? frozen, - $core.bool? visibility, - $core.int? width, - $core.bool? isPrimary, - }) { - final _result = create(); - if (id != null) { - _result.id = id; - } - if (name != null) { - _result.name = name; - } - if (desc != null) { - _result.desc = desc; - } - if (fieldType != null) { - _result.fieldType = fieldType; - } - if (frozen != null) { - _result.frozen = frozen; - } - if (visibility != null) { - _result.visibility = visibility; - } - if (width != null) { - _result.width = width; - } - if (isPrimary != null) { - _result.isPrimary = isPrimary; - } - return _result; - } - factory Field.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Field.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Field clone() => Field()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Field copyWith(void Function(Field) updates) => super.copyWith((message) => updates(message as Field)) as Field; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static Field create() => Field._(); - Field createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Field getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Field? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get id => $_getSZ(0); - @$pb.TagNumber(1) - set id($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasId() => $_has(0); - @$pb.TagNumber(1) - void clearId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get name => $_getSZ(1); - @$pb.TagNumber(2) - set name($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasName() => $_has(1); - @$pb.TagNumber(2) - void clearName() => clearField(2); - - @$pb.TagNumber(3) - $core.String get desc => $_getSZ(2); - @$pb.TagNumber(3) - set desc($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasDesc() => $_has(2); - @$pb.TagNumber(3) - void clearDesc() => clearField(3); - - @$pb.TagNumber(4) - FieldType get fieldType => $_getN(3); - @$pb.TagNumber(4) - set fieldType(FieldType v) { setField(4, v); } - @$pb.TagNumber(4) - $core.bool hasFieldType() => $_has(3); - @$pb.TagNumber(4) - void clearFieldType() => clearField(4); - - @$pb.TagNumber(5) - $core.bool get frozen => $_getBF(4); - @$pb.TagNumber(5) - set frozen($core.bool v) { $_setBool(4, v); } - @$pb.TagNumber(5) - $core.bool hasFrozen() => $_has(4); - @$pb.TagNumber(5) - void clearFrozen() => clearField(5); - - @$pb.TagNumber(6) - $core.bool get visibility => $_getBF(5); - @$pb.TagNumber(6) - set visibility($core.bool v) { $_setBool(5, v); } - @$pb.TagNumber(6) - $core.bool hasVisibility() => $_has(5); - @$pb.TagNumber(6) - void clearVisibility() => clearField(6); - - @$pb.TagNumber(7) - $core.int get width => $_getIZ(6); - @$pb.TagNumber(7) - set width($core.int v) { $_setSignedInt32(6, v); } - @$pb.TagNumber(7) - $core.bool hasWidth() => $_has(6); - @$pb.TagNumber(7) - void clearWidth() => clearField(7); - - @$pb.TagNumber(8) - $core.bool get isPrimary => $_getBF(7); - @$pb.TagNumber(8) - set isPrimary($core.bool v) { $_setBool(7, v); } - @$pb.TagNumber(8) - $core.bool hasIsPrimary() => $_has(7); - @$pb.TagNumber(8) - void clearIsPrimary() => clearField(8); -} - -class FieldOrder extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldOrder', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') - ..hasRequiredFields = false - ; - - FieldOrder._() : super(); - factory FieldOrder({ - $core.String? fieldId, - }) { - final _result = create(); - if (fieldId != null) { - _result.fieldId = fieldId; - } - return _result; - } - factory FieldOrder.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory FieldOrder.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - FieldOrder clone() => FieldOrder()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - FieldOrder copyWith(void Function(FieldOrder) updates) => super.copyWith((message) => updates(message as FieldOrder)) as FieldOrder; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static FieldOrder create() => FieldOrder._(); - FieldOrder createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static FieldOrder getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static FieldOrder? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get fieldId => $_getSZ(0); - @$pb.TagNumber(1) - set fieldId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasFieldId() => $_has(0); - @$pb.TagNumber(1) - void clearFieldId() => clearField(1); -} - -class GridFieldChangeset extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridFieldChangeset', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..pc(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'insertedFields', $pb.PbFieldType.PM, subBuilder: IndexField.create) - ..pc(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deletedFields', $pb.PbFieldType.PM, subBuilder: FieldOrder.create) - ..pc(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'updatedFields', $pb.PbFieldType.PM, subBuilder: Field.create) - ..hasRequiredFields = false - ; - - GridFieldChangeset._() : super(); - factory GridFieldChangeset({ - $core.String? gridId, - $core.Iterable? insertedFields, - $core.Iterable? deletedFields, - $core.Iterable? updatedFields, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (insertedFields != null) { - _result.insertedFields.addAll(insertedFields); - } - if (deletedFields != null) { - _result.deletedFields.addAll(deletedFields); - } - if (updatedFields != null) { - _result.updatedFields.addAll(updatedFields); - } - return _result; - } - factory GridFieldChangeset.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GridFieldChangeset.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GridFieldChangeset clone() => GridFieldChangeset()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GridFieldChangeset copyWith(void Function(GridFieldChangeset) updates) => super.copyWith((message) => updates(message as GridFieldChangeset)) as GridFieldChangeset; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static GridFieldChangeset create() => GridFieldChangeset._(); - GridFieldChangeset createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GridFieldChangeset getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GridFieldChangeset? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - $core.List get insertedFields => $_getList(1); - - @$pb.TagNumber(3) - $core.List get deletedFields => $_getList(2); - - @$pb.TagNumber(4) - $core.List get updatedFields => $_getList(3); -} - -class IndexField extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'IndexField', createEmptyInstance: create) - ..aOM(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'field', subBuilder: Field.create) - ..a<$core.int>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'index', $pb.PbFieldType.O3) - ..hasRequiredFields = false - ; - - IndexField._() : super(); - factory IndexField({ - Field? field_1, - $core.int? index, - }) { - final _result = create(); - if (field_1 != null) { - _result.field_1 = field_1; - } - if (index != null) { - _result.index = index; - } - return _result; - } - factory IndexField.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory IndexField.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - IndexField clone() => IndexField()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - IndexField copyWith(void Function(IndexField) updates) => super.copyWith((message) => updates(message as IndexField)) as IndexField; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static IndexField create() => IndexField._(); - IndexField createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static IndexField getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static IndexField? _defaultInstance; - - @$pb.TagNumber(1) - Field get field_1 => $_getN(0); - @$pb.TagNumber(1) - set field_1(Field v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasField_1() => $_has(0); - @$pb.TagNumber(1) - void clearField_1() => clearField(1); - @$pb.TagNumber(1) - Field ensureField_1() => $_ensure(0); - - @$pb.TagNumber(2) - $core.int get index => $_getIZ(1); - @$pb.TagNumber(2) - set index($core.int v) { $_setSignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasIndex() => $_has(1); - @$pb.TagNumber(2) - void clearIndex() => clearField(2); -} - -enum GetEditFieldContextPayload_OneOfFieldId { - fieldId, - notSet -} - -class GetEditFieldContextPayload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, GetEditFieldContextPayload_OneOfFieldId> _GetEditFieldContextPayload_OneOfFieldIdByTag = { - 2 : GetEditFieldContextPayload_OneOfFieldId.fieldId, - 0 : GetEditFieldContextPayload_OneOfFieldId.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GetEditFieldContextPayload', createEmptyInstance: create) - ..oo(0, [2]) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') - ..e(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) - ..hasRequiredFields = false - ; - - GetEditFieldContextPayload._() : super(); - factory GetEditFieldContextPayload({ - $core.String? gridId, - $core.String? fieldId, - FieldType? fieldType, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (fieldId != null) { - _result.fieldId = fieldId; - } - if (fieldType != null) { - _result.fieldType = fieldType; - } - return _result; - } - factory GetEditFieldContextPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetEditFieldContextPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetEditFieldContextPayload clone() => GetEditFieldContextPayload()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetEditFieldContextPayload copyWith(void Function(GetEditFieldContextPayload) updates) => super.copyWith((message) => updates(message as GetEditFieldContextPayload)) as GetEditFieldContextPayload; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static GetEditFieldContextPayload create() => GetEditFieldContextPayload._(); - GetEditFieldContextPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetEditFieldContextPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetEditFieldContextPayload? _defaultInstance; - - GetEditFieldContextPayload_OneOfFieldId whichOneOfFieldId() => _GetEditFieldContextPayload_OneOfFieldIdByTag[$_whichOneof(0)]!; - void clearOneOfFieldId() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get fieldId => $_getSZ(1); - @$pb.TagNumber(2) - set fieldId($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasFieldId() => $_has(1); - @$pb.TagNumber(2) - void clearFieldId() => clearField(2); - - @$pb.TagNumber(3) - FieldType get fieldType => $_getN(2); - @$pb.TagNumber(3) - set fieldType(FieldType v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasFieldType() => $_has(2); - @$pb.TagNumber(3) - void clearFieldType() => clearField(3); -} - -class EditFieldPayload extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'EditFieldPayload', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') - ..e(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) - ..aOB(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'createIfNotExist') - ..hasRequiredFields = false - ; - - EditFieldPayload._() : super(); - factory EditFieldPayload({ - $core.String? gridId, - $core.String? fieldId, - FieldType? fieldType, - $core.bool? createIfNotExist, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (fieldId != null) { - _result.fieldId = fieldId; - } - if (fieldType != null) { - _result.fieldType = fieldType; - } - if (createIfNotExist != null) { - _result.createIfNotExist = createIfNotExist; - } - return _result; - } - factory EditFieldPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory EditFieldPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - EditFieldPayload clone() => EditFieldPayload()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - EditFieldPayload copyWith(void Function(EditFieldPayload) updates) => super.copyWith((message) => updates(message as EditFieldPayload)) as EditFieldPayload; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static EditFieldPayload create() => EditFieldPayload._(); - EditFieldPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static EditFieldPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static EditFieldPayload? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get fieldId => $_getSZ(1); - @$pb.TagNumber(2) - set fieldId($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasFieldId() => $_has(1); - @$pb.TagNumber(2) - void clearFieldId() => clearField(2); - - @$pb.TagNumber(3) - FieldType get fieldType => $_getN(2); - @$pb.TagNumber(3) - set fieldType(FieldType v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasFieldType() => $_has(2); - @$pb.TagNumber(3) - void clearFieldType() => clearField(3); - - @$pb.TagNumber(4) - $core.bool get createIfNotExist => $_getBF(3); - @$pb.TagNumber(4) - set createIfNotExist($core.bool v) { $_setBool(3, v); } - @$pb.TagNumber(4) - $core.bool hasCreateIfNotExist() => $_has(3); - @$pb.TagNumber(4) - void clearCreateIfNotExist() => clearField(4); -} - -class FieldTypeOptionContext extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldTypeOptionContext', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridField', subBuilder: Field.create) - ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; - - FieldTypeOptionContext._() : super(); - factory FieldTypeOptionContext({ - $core.String? gridId, - Field? gridField, - $core.List<$core.int>? typeOptionData, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (gridField != null) { - _result.gridField = gridField; - } - if (typeOptionData != null) { - _result.typeOptionData = typeOptionData; - } - return _result; - } - factory FieldTypeOptionContext.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory FieldTypeOptionContext.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - FieldTypeOptionContext clone() => FieldTypeOptionContext()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - FieldTypeOptionContext copyWith(void Function(FieldTypeOptionContext) updates) => super.copyWith((message) => updates(message as FieldTypeOptionContext)) as FieldTypeOptionContext; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static FieldTypeOptionContext create() => FieldTypeOptionContext._(); - FieldTypeOptionContext createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static FieldTypeOptionContext getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static FieldTypeOptionContext? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - Field get gridField => $_getN(1); - @$pb.TagNumber(2) - set gridField(Field v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasGridField() => $_has(1); - @$pb.TagNumber(2) - void clearGridField() => clearField(2); - @$pb.TagNumber(2) - Field ensureGridField() => $_ensure(1); - - @$pb.TagNumber(3) - $core.List<$core.int> get typeOptionData => $_getN(2); - @$pb.TagNumber(3) - set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } - @$pb.TagNumber(3) - $core.bool hasTypeOptionData() => $_has(2); - @$pb.TagNumber(3) - void clearTypeOptionData() => clearField(3); -} - -class FieldTypeOptionData extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldTypeOptionData', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'field', subBuilder: Field.create) - ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; - - FieldTypeOptionData._() : super(); - factory FieldTypeOptionData({ - $core.String? gridId, - Field? field_2, - $core.List<$core.int>? typeOptionData, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (field_2 != null) { - _result.field_2 = field_2; - } - if (typeOptionData != null) { - _result.typeOptionData = typeOptionData; - } - return _result; - } - factory FieldTypeOptionData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory FieldTypeOptionData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - FieldTypeOptionData clone() => FieldTypeOptionData()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - FieldTypeOptionData copyWith(void Function(FieldTypeOptionData) updates) => super.copyWith((message) => updates(message as FieldTypeOptionData)) as FieldTypeOptionData; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static FieldTypeOptionData create() => FieldTypeOptionData._(); - FieldTypeOptionData createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static FieldTypeOptionData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static FieldTypeOptionData? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - Field get field_2 => $_getN(1); - @$pb.TagNumber(2) - set field_2(Field v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasField_2() => $_has(1); - @$pb.TagNumber(2) - void clearField_2() => clearField(2); - @$pb.TagNumber(2) - Field ensureField_2() => $_ensure(1); - - @$pb.TagNumber(3) - $core.List<$core.int> get typeOptionData => $_getN(2); - @$pb.TagNumber(3) - set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } - @$pb.TagNumber(3) - $core.bool hasTypeOptionData() => $_has(2); - @$pb.TagNumber(3) - void clearTypeOptionData() => clearField(3); -} - -class RepeatedField extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedField', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: Field.create) - ..hasRequiredFields = false - ; - - RepeatedField._() : super(); - factory RepeatedField({ - $core.Iterable? items, - }) { - final _result = create(); - if (items != null) { - _result.items.addAll(items); - } - return _result; - } - factory RepeatedField.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RepeatedField.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - RepeatedField clone() => RepeatedField()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - RepeatedField copyWith(void Function(RepeatedField) updates) => super.copyWith((message) => updates(message as RepeatedField)) as RepeatedField; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static RepeatedField create() => RepeatedField._(); - RepeatedField createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static RepeatedField getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static RepeatedField? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get items => $_getList(0); -} - -class RepeatedFieldOrder extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedFieldOrder', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: FieldOrder.create) - ..hasRequiredFields = false - ; - - RepeatedFieldOrder._() : super(); - factory RepeatedFieldOrder({ - $core.Iterable? items, - }) { - final _result = create(); - if (items != null) { - _result.items.addAll(items); - } - return _result; - } - factory RepeatedFieldOrder.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RepeatedFieldOrder.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - RepeatedFieldOrder clone() => RepeatedFieldOrder()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - RepeatedFieldOrder copyWith(void Function(RepeatedFieldOrder) updates) => super.copyWith((message) => updates(message as RepeatedFieldOrder)) as RepeatedFieldOrder; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static RepeatedFieldOrder create() => RepeatedFieldOrder._(); - RepeatedFieldOrder createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static RepeatedFieldOrder getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static RepeatedFieldOrder? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get items => $_getList(0); -} - class RowOrder extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RowOrder', createEmptyInstance: create) ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowId') @@ -1680,248 +943,6 @@ class CreateRowPayload extends $pb.GeneratedMessage { void clearStartRowId() => clearField(2); } -enum InsertFieldPayload_OneOfStartFieldId { - startFieldId, - notSet -} - -class InsertFieldPayload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, InsertFieldPayload_OneOfStartFieldId> _InsertFieldPayload_OneOfStartFieldIdByTag = { - 4 : InsertFieldPayload_OneOfStartFieldId.startFieldId, - 0 : InsertFieldPayload_OneOfStartFieldId.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'InsertFieldPayload', createEmptyInstance: create) - ..oo(0, [4]) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'field', subBuilder: Field.create) - ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) - ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'startFieldId') - ..hasRequiredFields = false - ; - - InsertFieldPayload._() : super(); - factory InsertFieldPayload({ - $core.String? gridId, - Field? field_2, - $core.List<$core.int>? typeOptionData, - $core.String? startFieldId, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (field_2 != null) { - _result.field_2 = field_2; - } - if (typeOptionData != null) { - _result.typeOptionData = typeOptionData; - } - if (startFieldId != null) { - _result.startFieldId = startFieldId; - } - return _result; - } - factory InsertFieldPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory InsertFieldPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - InsertFieldPayload clone() => InsertFieldPayload()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - InsertFieldPayload copyWith(void Function(InsertFieldPayload) updates) => super.copyWith((message) => updates(message as InsertFieldPayload)) as InsertFieldPayload; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static InsertFieldPayload create() => InsertFieldPayload._(); - InsertFieldPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static InsertFieldPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static InsertFieldPayload? _defaultInstance; - - InsertFieldPayload_OneOfStartFieldId whichOneOfStartFieldId() => _InsertFieldPayload_OneOfStartFieldIdByTag[$_whichOneof(0)]!; - void clearOneOfStartFieldId() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - Field get field_2 => $_getN(1); - @$pb.TagNumber(2) - set field_2(Field v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasField_2() => $_has(1); - @$pb.TagNumber(2) - void clearField_2() => clearField(2); - @$pb.TagNumber(2) - Field ensureField_2() => $_ensure(1); - - @$pb.TagNumber(3) - $core.List<$core.int> get typeOptionData => $_getN(2); - @$pb.TagNumber(3) - set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } - @$pb.TagNumber(3) - $core.bool hasTypeOptionData() => $_has(2); - @$pb.TagNumber(3) - void clearTypeOptionData() => clearField(3); - - @$pb.TagNumber(4) - $core.String get startFieldId => $_getSZ(3); - @$pb.TagNumber(4) - set startFieldId($core.String v) { $_setString(3, v); } - @$pb.TagNumber(4) - $core.bool hasStartFieldId() => $_has(3); - @$pb.TagNumber(4) - void clearStartFieldId() => clearField(4); -} - -class UpdateFieldTypeOptionPayload extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateFieldTypeOptionPayload', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') - ..a<$core.List<$core.int>>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; - - UpdateFieldTypeOptionPayload._() : super(); - factory UpdateFieldTypeOptionPayload({ - $core.String? gridId, - $core.String? fieldId, - $core.List<$core.int>? typeOptionData, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (fieldId != null) { - _result.fieldId = fieldId; - } - if (typeOptionData != null) { - _result.typeOptionData = typeOptionData; - } - return _result; - } - factory UpdateFieldTypeOptionPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory UpdateFieldTypeOptionPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - UpdateFieldTypeOptionPayload clone() => UpdateFieldTypeOptionPayload()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - UpdateFieldTypeOptionPayload copyWith(void Function(UpdateFieldTypeOptionPayload) updates) => super.copyWith((message) => updates(message as UpdateFieldTypeOptionPayload)) as UpdateFieldTypeOptionPayload; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static UpdateFieldTypeOptionPayload create() => UpdateFieldTypeOptionPayload._(); - UpdateFieldTypeOptionPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static UpdateFieldTypeOptionPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static UpdateFieldTypeOptionPayload? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get fieldId => $_getSZ(1); - @$pb.TagNumber(2) - set fieldId($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasFieldId() => $_has(1); - @$pb.TagNumber(2) - void clearFieldId() => clearField(2); - - @$pb.TagNumber(3) - $core.List<$core.int> get typeOptionData => $_getN(2); - @$pb.TagNumber(3) - set typeOptionData($core.List<$core.int> v) { $_setBytes(2, v); } - @$pb.TagNumber(3) - $core.bool hasTypeOptionData() => $_has(2); - @$pb.TagNumber(3) - void clearTypeOptionData() => clearField(3); -} - -class QueryFieldPayload extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryFieldPayload', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldOrders', subBuilder: RepeatedFieldOrder.create) - ..hasRequiredFields = false - ; - - QueryFieldPayload._() : super(); - factory QueryFieldPayload({ - $core.String? gridId, - RepeatedFieldOrder? fieldOrders, - }) { - final _result = create(); - if (gridId != null) { - _result.gridId = gridId; - } - if (fieldOrders != null) { - _result.fieldOrders = fieldOrders; - } - return _result; - } - factory QueryFieldPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory QueryFieldPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - QueryFieldPayload clone() => QueryFieldPayload()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - QueryFieldPayload copyWith(void Function(QueryFieldPayload) updates) => super.copyWith((message) => updates(message as QueryFieldPayload)) as QueryFieldPayload; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static QueryFieldPayload create() => QueryFieldPayload._(); - QueryFieldPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static QueryFieldPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static QueryFieldPayload? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get gridId => $_getSZ(0); - @$pb.TagNumber(1) - set gridId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGridId() => $_has(0); - @$pb.TagNumber(1) - void clearGridId() => clearField(1); - - @$pb.TagNumber(2) - RepeatedFieldOrder get fieldOrders => $_getN(1); - @$pb.TagNumber(2) - set fieldOrders(RepeatedFieldOrder v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasFieldOrders() => $_has(1); - @$pb.TagNumber(2) - void clearFieldOrders() => clearField(2); - @$pb.TagNumber(2) - RepeatedFieldOrder ensureFieldOrders() => $_ensure(1); -} - class QueryGridBlocksPayload extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryGridBlocksPayload', createEmptyInstance: create) ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') @@ -1977,256 +998,6 @@ class QueryGridBlocksPayload extends $pb.GeneratedMessage { $core.List get blockOrders => $_getList(1); } -enum FieldChangesetPayload_OneOfName { - name, - notSet -} - -enum FieldChangesetPayload_OneOfDesc { - desc, - notSet -} - -enum FieldChangesetPayload_OneOfFieldType { - fieldType, - notSet -} - -enum FieldChangesetPayload_OneOfFrozen { - frozen, - notSet -} - -enum FieldChangesetPayload_OneOfVisibility { - visibility, - notSet -} - -enum FieldChangesetPayload_OneOfWidth { - width, - notSet -} - -enum FieldChangesetPayload_OneOfTypeOptionData { - typeOptionData, - notSet -} - -class FieldChangesetPayload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, FieldChangesetPayload_OneOfName> _FieldChangesetPayload_OneOfNameByTag = { - 3 : FieldChangesetPayload_OneOfName.name, - 0 : FieldChangesetPayload_OneOfName.notSet - }; - static const $core.Map<$core.int, FieldChangesetPayload_OneOfDesc> _FieldChangesetPayload_OneOfDescByTag = { - 4 : FieldChangesetPayload_OneOfDesc.desc, - 0 : FieldChangesetPayload_OneOfDesc.notSet - }; - static const $core.Map<$core.int, FieldChangesetPayload_OneOfFieldType> _FieldChangesetPayload_OneOfFieldTypeByTag = { - 5 : FieldChangesetPayload_OneOfFieldType.fieldType, - 0 : FieldChangesetPayload_OneOfFieldType.notSet - }; - static const $core.Map<$core.int, FieldChangesetPayload_OneOfFrozen> _FieldChangesetPayload_OneOfFrozenByTag = { - 6 : FieldChangesetPayload_OneOfFrozen.frozen, - 0 : FieldChangesetPayload_OneOfFrozen.notSet - }; - static const $core.Map<$core.int, FieldChangesetPayload_OneOfVisibility> _FieldChangesetPayload_OneOfVisibilityByTag = { - 7 : FieldChangesetPayload_OneOfVisibility.visibility, - 0 : FieldChangesetPayload_OneOfVisibility.notSet - }; - static const $core.Map<$core.int, FieldChangesetPayload_OneOfWidth> _FieldChangesetPayload_OneOfWidthByTag = { - 8 : FieldChangesetPayload_OneOfWidth.width, - 0 : FieldChangesetPayload_OneOfWidth.notSet - }; - static const $core.Map<$core.int, FieldChangesetPayload_OneOfTypeOptionData> _FieldChangesetPayload_OneOfTypeOptionDataByTag = { - 9 : FieldChangesetPayload_OneOfTypeOptionData.typeOptionData, - 0 : FieldChangesetPayload_OneOfTypeOptionData.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldChangesetPayload', createEmptyInstance: create) - ..oo(0, [3]) - ..oo(1, [4]) - ..oo(2, [5]) - ..oo(3, [6]) - ..oo(4, [7]) - ..oo(5, [8]) - ..oo(6, [9]) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') - ..e(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) - ..aOB(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'frozen') - ..aOB(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'visibility') - ..a<$core.int>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3) - ..a<$core.List<$core.int>>(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; - - FieldChangesetPayload._() : super(); - factory FieldChangesetPayload({ - $core.String? fieldId, - $core.String? gridId, - $core.String? name, - $core.String? desc, - FieldType? fieldType, - $core.bool? frozen, - $core.bool? visibility, - $core.int? width, - $core.List<$core.int>? typeOptionData, - }) { - final _result = create(); - if (fieldId != null) { - _result.fieldId = fieldId; - } - if (gridId != null) { - _result.gridId = gridId; - } - if (name != null) { - _result.name = name; - } - if (desc != null) { - _result.desc = desc; - } - if (fieldType != null) { - _result.fieldType = fieldType; - } - if (frozen != null) { - _result.frozen = frozen; - } - if (visibility != null) { - _result.visibility = visibility; - } - if (width != null) { - _result.width = width; - } - if (typeOptionData != null) { - _result.typeOptionData = typeOptionData; - } - return _result; - } - factory FieldChangesetPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory FieldChangesetPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - FieldChangesetPayload clone() => FieldChangesetPayload()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - FieldChangesetPayload copyWith(void Function(FieldChangesetPayload) updates) => super.copyWith((message) => updates(message as FieldChangesetPayload)) as FieldChangesetPayload; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static FieldChangesetPayload create() => FieldChangesetPayload._(); - FieldChangesetPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static FieldChangesetPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static FieldChangesetPayload? _defaultInstance; - - FieldChangesetPayload_OneOfName whichOneOfName() => _FieldChangesetPayload_OneOfNameByTag[$_whichOneof(0)]!; - void clearOneOfName() => clearField($_whichOneof(0)); - - FieldChangesetPayload_OneOfDesc whichOneOfDesc() => _FieldChangesetPayload_OneOfDescByTag[$_whichOneof(1)]!; - void clearOneOfDesc() => clearField($_whichOneof(1)); - - FieldChangesetPayload_OneOfFieldType whichOneOfFieldType() => _FieldChangesetPayload_OneOfFieldTypeByTag[$_whichOneof(2)]!; - void clearOneOfFieldType() => clearField($_whichOneof(2)); - - FieldChangesetPayload_OneOfFrozen whichOneOfFrozen() => _FieldChangesetPayload_OneOfFrozenByTag[$_whichOneof(3)]!; - void clearOneOfFrozen() => clearField($_whichOneof(3)); - - FieldChangesetPayload_OneOfVisibility whichOneOfVisibility() => _FieldChangesetPayload_OneOfVisibilityByTag[$_whichOneof(4)]!; - void clearOneOfVisibility() => clearField($_whichOneof(4)); - - FieldChangesetPayload_OneOfWidth whichOneOfWidth() => _FieldChangesetPayload_OneOfWidthByTag[$_whichOneof(5)]!; - void clearOneOfWidth() => clearField($_whichOneof(5)); - - FieldChangesetPayload_OneOfTypeOptionData whichOneOfTypeOptionData() => _FieldChangesetPayload_OneOfTypeOptionDataByTag[$_whichOneof(6)]!; - void clearOneOfTypeOptionData() => clearField($_whichOneof(6)); - - @$pb.TagNumber(1) - $core.String get fieldId => $_getSZ(0); - @$pb.TagNumber(1) - set fieldId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasFieldId() => $_has(0); - @$pb.TagNumber(1) - void clearFieldId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get gridId => $_getSZ(1); - @$pb.TagNumber(2) - set gridId($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasGridId() => $_has(1); - @$pb.TagNumber(2) - void clearGridId() => clearField(2); - - @$pb.TagNumber(3) - $core.String get name => $_getSZ(2); - @$pb.TagNumber(3) - set name($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasName() => $_has(2); - @$pb.TagNumber(3) - void clearName() => clearField(3); - - @$pb.TagNumber(4) - $core.String get desc => $_getSZ(3); - @$pb.TagNumber(4) - set desc($core.String v) { $_setString(3, v); } - @$pb.TagNumber(4) - $core.bool hasDesc() => $_has(3); - @$pb.TagNumber(4) - void clearDesc() => clearField(4); - - @$pb.TagNumber(5) - FieldType get fieldType => $_getN(4); - @$pb.TagNumber(5) - set fieldType(FieldType v) { setField(5, v); } - @$pb.TagNumber(5) - $core.bool hasFieldType() => $_has(4); - @$pb.TagNumber(5) - void clearFieldType() => clearField(5); - - @$pb.TagNumber(6) - $core.bool get frozen => $_getBF(5); - @$pb.TagNumber(6) - set frozen($core.bool v) { $_setBool(5, v); } - @$pb.TagNumber(6) - $core.bool hasFrozen() => $_has(5); - @$pb.TagNumber(6) - void clearFrozen() => clearField(6); - - @$pb.TagNumber(7) - $core.bool get visibility => $_getBF(6); - @$pb.TagNumber(7) - set visibility($core.bool v) { $_setBool(6, v); } - @$pb.TagNumber(7) - $core.bool hasVisibility() => $_has(6); - @$pb.TagNumber(7) - void clearVisibility() => clearField(7); - - @$pb.TagNumber(8) - $core.int get width => $_getIZ(7); - @$pb.TagNumber(8) - set width($core.int v) { $_setSignedInt32(7, v); } - @$pb.TagNumber(8) - $core.bool hasWidth() => $_has(7); - @$pb.TagNumber(8) - void clearWidth() => clearField(8); - - @$pb.TagNumber(9) - $core.List<$core.int> get typeOptionData => $_getN(8); - @$pb.TagNumber(9) - set typeOptionData($core.List<$core.int> v) { $_setBytes(8, v); } - @$pb.TagNumber(9) - $core.bool hasTypeOptionData() => $_has(8); - @$pb.TagNumber(9) - void clearTypeOptionData() => clearField(9); -} - class MoveItemPayload extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'MoveItemPayload', createEmptyInstance: create) ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbenum.dart index 78331a46e5..b96a36b254 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbenum.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbenum.dart @@ -24,28 +24,3 @@ class MoveItemType extends $pb.ProtobufEnum { const MoveItemType._($core.int v, $core.String n) : super(v, n); } -class FieldType extends $pb.ProtobufEnum { - static const FieldType RichText = FieldType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RichText'); - static const FieldType Number = FieldType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Number'); - static const FieldType DateTime = FieldType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DateTime'); - static const FieldType SingleSelect = FieldType._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SingleSelect'); - static const FieldType MultiSelect = FieldType._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MultiSelect'); - static const FieldType Checkbox = FieldType._(5, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Checkbox'); - static const FieldType URL = FieldType._(6, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'URL'); - - static const $core.List values = [ - RichText, - Number, - DateTime, - SingleSelect, - MultiSelect, - Checkbox, - URL, - ]; - - static final $core.Map<$core.int, FieldType> _byValue = $pb.ProtobufEnum.initByValue(values); - static FieldType? valueOf($core.int value) => _byValue[value]; - - const FieldType._($core.int v, $core.String n) : super(v, n); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart index 7c28fa1ceb..7b8d03a84c 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart @@ -19,22 +19,6 @@ const MoveItemType$json = const { /// Descriptor for `MoveItemType`. Decode as a `google.protobuf.EnumDescriptorProto`. final $typed_data.Uint8List moveItemTypeDescriptor = $convert.base64Decode('CgxNb3ZlSXRlbVR5cGUSDQoJTW92ZUZpZWxkEAASCwoHTW92ZVJvdxAB'); -@$core.Deprecated('Use fieldTypeDescriptor instead') -const FieldType$json = const { - '1': 'FieldType', - '2': const [ - const {'1': 'RichText', '2': 0}, - const {'1': 'Number', '2': 1}, - const {'1': 'DateTime', '2': 2}, - const {'1': 'SingleSelect', '2': 3}, - const {'1': 'MultiSelect', '2': 4}, - const {'1': 'Checkbox', '2': 5}, - const {'1': 'URL', '2': 6}, - ], -}; - -/// Descriptor for `FieldType`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List fieldTypeDescriptor = $convert.base64Decode('CglGaWVsZFR5cGUSDAoIUmljaFRleHQQABIKCgZOdW1iZXIQARIMCghEYXRlVGltZRACEhAKDFNpbmdsZVNlbGVjdBADEg8KC011bHRpU2VsZWN0EAQSDAoIQ2hlY2tib3gQBRIHCgNVUkwQBg=='); @$core.Deprecated('Use gridDescriptor instead') const Grid$json = const { '1': 'Grid', @@ -47,129 +31,6 @@ const Grid$json = const { /// Descriptor for `Grid`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List gridDescriptor = $convert.base64Decode('CgRHcmlkEg4KAmlkGAEgASgJUgJpZBIuCgxmaWVsZF9vcmRlcnMYAiADKAsyCy5GaWVsZE9yZGVyUgtmaWVsZE9yZGVycxIyCgxibG9ja19vcmRlcnMYAyADKAsyDy5HcmlkQmxvY2tPcmRlclILYmxvY2tPcmRlcnM='); -@$core.Deprecated('Use fieldDescriptor instead') -const Field$json = const { - '1': 'Field', - '2': const [ - const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, - const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, - const {'1': 'desc', '3': 3, '4': 1, '5': 9, '10': 'desc'}, - const {'1': 'field_type', '3': 4, '4': 1, '5': 14, '6': '.FieldType', '10': 'fieldType'}, - const {'1': 'frozen', '3': 5, '4': 1, '5': 8, '10': 'frozen'}, - const {'1': 'visibility', '3': 6, '4': 1, '5': 8, '10': 'visibility'}, - const {'1': 'width', '3': 7, '4': 1, '5': 5, '10': 'width'}, - const {'1': 'is_primary', '3': 8, '4': 1, '5': 8, '10': 'isPrimary'}, - ], -}; - -/// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode('CgVGaWVsZBIOCgJpZBgBIAEoCVICaWQSEgoEbmFtZRgCIAEoCVIEbmFtZRISCgRkZXNjGAMgASgJUgRkZXNjEikKCmZpZWxkX3R5cGUYBCABKA4yCi5GaWVsZFR5cGVSCWZpZWxkVHlwZRIWCgZmcm96ZW4YBSABKAhSBmZyb3plbhIeCgp2aXNpYmlsaXR5GAYgASgIUgp2aXNpYmlsaXR5EhQKBXdpZHRoGAcgASgFUgV3aWR0aBIdCgppc19wcmltYXJ5GAggASgIUglpc1ByaW1hcnk='); -@$core.Deprecated('Use fieldOrderDescriptor instead') -const FieldOrder$json = const { - '1': 'FieldOrder', - '2': const [ - const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, - ], -}; - -/// Descriptor for `FieldOrder`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldOrderDescriptor = $convert.base64Decode('CgpGaWVsZE9yZGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElk'); -@$core.Deprecated('Use gridFieldChangesetDescriptor instead') -const GridFieldChangeset$json = const { - '1': 'GridFieldChangeset', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'inserted_fields', '3': 2, '4': 3, '5': 11, '6': '.IndexField', '10': 'insertedFields'}, - const {'1': 'deleted_fields', '3': 3, '4': 3, '5': 11, '6': '.FieldOrder', '10': 'deletedFields'}, - const {'1': 'updated_fields', '3': 4, '4': 3, '5': 11, '6': '.Field', '10': 'updatedFields'}, - ], -}; - -/// Descriptor for `GridFieldChangeset`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List gridFieldChangesetDescriptor = $convert.base64Decode('ChJHcmlkRmllbGRDaGFuZ2VzZXQSFwoHZ3JpZF9pZBgBIAEoCVIGZ3JpZElkEjQKD2luc2VydGVkX2ZpZWxkcxgCIAMoCzILLkluZGV4RmllbGRSDmluc2VydGVkRmllbGRzEjIKDmRlbGV0ZWRfZmllbGRzGAMgAygLMgsuRmllbGRPcmRlclINZGVsZXRlZEZpZWxkcxItCg51cGRhdGVkX2ZpZWxkcxgEIAMoCzIGLkZpZWxkUg11cGRhdGVkRmllbGRz'); -@$core.Deprecated('Use indexFieldDescriptor instead') -const IndexField$json = const { - '1': 'IndexField', - '2': const [ - const {'1': 'field', '3': 1, '4': 1, '5': 11, '6': '.Field', '10': 'field'}, - const {'1': 'index', '3': 2, '4': 1, '5': 5, '10': 'index'}, - ], -}; - -/// Descriptor for `IndexField`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List indexFieldDescriptor = $convert.base64Decode('CgpJbmRleEZpZWxkEhwKBWZpZWxkGAEgASgLMgYuRmllbGRSBWZpZWxkEhQKBWluZGV4GAIgASgFUgVpbmRleA=='); -@$core.Deprecated('Use getEditFieldContextPayloadDescriptor instead') -const GetEditFieldContextPayload$json = const { - '1': 'GetEditFieldContextPayload', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'field_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'fieldId'}, - const {'1': 'field_type', '3': 3, '4': 1, '5': 14, '6': '.FieldType', '10': 'fieldType'}, - ], - '8': const [ - const {'1': 'one_of_field_id'}, - ], -}; - -/// Descriptor for `GetEditFieldContextPayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getEditFieldContextPayloadDescriptor = $convert.base64Decode('ChpHZXRFZGl0RmllbGRDb250ZXh0UGF5bG9hZBIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSGwoIZmllbGRfaWQYAiABKAlIAFIHZmllbGRJZBIpCgpmaWVsZF90eXBlGAMgASgOMgouRmllbGRUeXBlUglmaWVsZFR5cGVCEQoPb25lX29mX2ZpZWxkX2lk'); -@$core.Deprecated('Use editFieldPayloadDescriptor instead') -const EditFieldPayload$json = const { - '1': 'EditFieldPayload', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'field_id', '3': 2, '4': 1, '5': 9, '10': 'fieldId'}, - const {'1': 'field_type', '3': 3, '4': 1, '5': 14, '6': '.FieldType', '10': 'fieldType'}, - const {'1': 'create_if_not_exist', '3': 4, '4': 1, '5': 8, '10': 'createIfNotExist'}, - ], -}; - -/// Descriptor for `EditFieldPayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List editFieldPayloadDescriptor = $convert.base64Decode('ChBFZGl0RmllbGRQYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIZCghmaWVsZF9pZBgCIAEoCVIHZmllbGRJZBIpCgpmaWVsZF90eXBlGAMgASgOMgouRmllbGRUeXBlUglmaWVsZFR5cGUSLQoTY3JlYXRlX2lmX25vdF9leGlzdBgEIAEoCFIQY3JlYXRlSWZOb3RFeGlzdA=='); -@$core.Deprecated('Use fieldTypeOptionContextDescriptor instead') -const FieldTypeOptionContext$json = const { - '1': 'FieldTypeOptionContext', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'grid_field', '3': 2, '4': 1, '5': 11, '6': '.Field', '10': 'gridField'}, - const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, - ], -}; - -/// Descriptor for `FieldTypeOptionContext`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldTypeOptionContextDescriptor = $convert.base64Decode('ChZGaWVsZFR5cGVPcHRpb25Db250ZXh0EhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIlCgpncmlkX2ZpZWxkGAIgASgLMgYuRmllbGRSCWdyaWRGaWVsZBIoChB0eXBlX29wdGlvbl9kYXRhGAMgASgMUg50eXBlT3B0aW9uRGF0YQ=='); -@$core.Deprecated('Use fieldTypeOptionDataDescriptor instead') -const FieldTypeOptionData$json = const { - '1': 'FieldTypeOptionData', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'field', '3': 2, '4': 1, '5': 11, '6': '.Field', '10': 'field'}, - const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, - ], -}; - -/// Descriptor for `FieldTypeOptionData`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldTypeOptionDataDescriptor = $convert.base64Decode('ChNGaWVsZFR5cGVPcHRpb25EYXRhEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIcCgVmaWVsZBgCIAEoCzIGLkZpZWxkUgVmaWVsZBIoChB0eXBlX29wdGlvbl9kYXRhGAMgASgMUg50eXBlT3B0aW9uRGF0YQ=='); -@$core.Deprecated('Use repeatedFieldDescriptor instead') -const RepeatedField$json = const { - '1': 'RepeatedField', - '2': const [ - const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.Field', '10': 'items'}, - ], -}; - -/// Descriptor for `RepeatedField`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List repeatedFieldDescriptor = $convert.base64Decode('Cg1SZXBlYXRlZEZpZWxkEhwKBWl0ZW1zGAEgAygLMgYuRmllbGRSBWl0ZW1z'); -@$core.Deprecated('Use repeatedFieldOrderDescriptor instead') -const RepeatedFieldOrder$json = const { - '1': 'RepeatedFieldOrder', - '2': const [ - const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.FieldOrder', '10': 'items'}, - ], -}; - -/// Descriptor for `RepeatedFieldOrder`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List repeatedFieldOrderDescriptor = $convert.base64Decode('ChJSZXBlYXRlZEZpZWxkT3JkZXISIQoFaXRlbXMYASADKAsyCy5GaWVsZE9yZGVyUgVpdGVtcw=='); @$core.Deprecated('Use rowOrderDescriptor instead') const RowOrder$json = const { '1': 'RowOrder', @@ -350,45 +211,6 @@ const CreateRowPayload$json = const { /// Descriptor for `CreateRowPayload`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List createRowPayloadDescriptor = $convert.base64Decode('ChBDcmVhdGVSb3dQYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIiCgxzdGFydF9yb3dfaWQYAiABKAlIAFIKc3RhcnRSb3dJZEIVChNvbmVfb2Zfc3RhcnRfcm93X2lk'); -@$core.Deprecated('Use insertFieldPayloadDescriptor instead') -const InsertFieldPayload$json = const { - '1': 'InsertFieldPayload', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'field', '3': 2, '4': 1, '5': 11, '6': '.Field', '10': 'field'}, - const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, - const {'1': 'start_field_id', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'startFieldId'}, - ], - '8': const [ - const {'1': 'one_of_start_field_id'}, - ], -}; - -/// Descriptor for `InsertFieldPayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List insertFieldPayloadDescriptor = $convert.base64Decode('ChJJbnNlcnRGaWVsZFBheWxvYWQSFwoHZ3JpZF9pZBgBIAEoCVIGZ3JpZElkEhwKBWZpZWxkGAIgASgLMgYuRmllbGRSBWZpZWxkEigKEHR5cGVfb3B0aW9uX2RhdGEYAyABKAxSDnR5cGVPcHRpb25EYXRhEiYKDnN0YXJ0X2ZpZWxkX2lkGAQgASgJSABSDHN0YXJ0RmllbGRJZEIXChVvbmVfb2Zfc3RhcnRfZmllbGRfaWQ='); -@$core.Deprecated('Use updateFieldTypeOptionPayloadDescriptor instead') -const UpdateFieldTypeOptionPayload$json = const { - '1': 'UpdateFieldTypeOptionPayload', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'field_id', '3': 2, '4': 1, '5': 9, '10': 'fieldId'}, - const {'1': 'type_option_data', '3': 3, '4': 1, '5': 12, '10': 'typeOptionData'}, - ], -}; - -/// Descriptor for `UpdateFieldTypeOptionPayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List updateFieldTypeOptionPayloadDescriptor = $convert.base64Decode('ChxVcGRhdGVGaWVsZFR5cGVPcHRpb25QYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIZCghmaWVsZF9pZBgCIAEoCVIHZmllbGRJZBIoChB0eXBlX29wdGlvbl9kYXRhGAMgASgMUg50eXBlT3B0aW9uRGF0YQ=='); -@$core.Deprecated('Use queryFieldPayloadDescriptor instead') -const QueryFieldPayload$json = const { - '1': 'QueryFieldPayload', - '2': const [ - const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'field_orders', '3': 2, '4': 1, '5': 11, '6': '.RepeatedFieldOrder', '10': 'fieldOrders'}, - ], -}; - -/// Descriptor for `QueryFieldPayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List queryFieldPayloadDescriptor = $convert.base64Decode('ChFRdWVyeUZpZWxkUGF5bG9hZBIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSNgoMZmllbGRfb3JkZXJzGAIgASgLMhMuUmVwZWF0ZWRGaWVsZE9yZGVyUgtmaWVsZE9yZGVycw=='); @$core.Deprecated('Use queryGridBlocksPayloadDescriptor instead') const QueryGridBlocksPayload$json = const { '1': 'QueryGridBlocksPayload', @@ -400,33 +222,6 @@ const QueryGridBlocksPayload$json = const { /// Descriptor for `QueryGridBlocksPayload`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List queryGridBlocksPayloadDescriptor = $convert.base64Decode('ChZRdWVyeUdyaWRCbG9ja3NQYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIyCgxibG9ja19vcmRlcnMYAiADKAsyDy5HcmlkQmxvY2tPcmRlclILYmxvY2tPcmRlcnM='); -@$core.Deprecated('Use fieldChangesetPayloadDescriptor instead') -const FieldChangesetPayload$json = const { - '1': 'FieldChangesetPayload', - '2': const [ - const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, - const {'1': 'grid_id', '3': 2, '4': 1, '5': 9, '10': 'gridId'}, - const {'1': 'name', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'name'}, - const {'1': 'desc', '3': 4, '4': 1, '5': 9, '9': 1, '10': 'desc'}, - const {'1': 'field_type', '3': 5, '4': 1, '5': 14, '6': '.FieldType', '9': 2, '10': 'fieldType'}, - const {'1': 'frozen', '3': 6, '4': 1, '5': 8, '9': 3, '10': 'frozen'}, - const {'1': 'visibility', '3': 7, '4': 1, '5': 8, '9': 4, '10': 'visibility'}, - const {'1': 'width', '3': 8, '4': 1, '5': 5, '9': 5, '10': 'width'}, - const {'1': 'type_option_data', '3': 9, '4': 1, '5': 12, '9': 6, '10': 'typeOptionData'}, - ], - '8': const [ - const {'1': 'one_of_name'}, - const {'1': 'one_of_desc'}, - const {'1': 'one_of_field_type'}, - const {'1': 'one_of_frozen'}, - const {'1': 'one_of_visibility'}, - const {'1': 'one_of_width'}, - const {'1': 'one_of_type_option_data'}, - ], -}; - -/// Descriptor for `FieldChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldChangesetPayloadDescriptor = $convert.base64Decode('ChVGaWVsZENoYW5nZXNldFBheWxvYWQSGQoIZmllbGRfaWQYASABKAlSB2ZpZWxkSWQSFwoHZ3JpZF9pZBgCIAEoCVIGZ3JpZElkEhQKBG5hbWUYAyABKAlIAFIEbmFtZRIUCgRkZXNjGAQgASgJSAFSBGRlc2MSKwoKZmllbGRfdHlwZRgFIAEoDjIKLkZpZWxkVHlwZUgCUglmaWVsZFR5cGUSGAoGZnJvemVuGAYgASgISANSBmZyb3plbhIgCgp2aXNpYmlsaXR5GAcgASgISARSCnZpc2liaWxpdHkSFgoFd2lkdGgYCCABKAVIBVIFd2lkdGgSKgoQdHlwZV9vcHRpb25fZGF0YRgJIAEoDEgGUg50eXBlT3B0aW9uRGF0YUINCgtvbmVfb2ZfbmFtZUINCgtvbmVfb2ZfZGVzY0ITChFvbmVfb2ZfZmllbGRfdHlwZUIPCg1vbmVfb2ZfZnJvemVuQhMKEW9uZV9vZl92aXNpYmlsaXR5Qg4KDG9uZV9vZl93aWR0aEIZChdvbmVfb2ZfdHlwZV9vcHRpb25fZGF0YQ=='); @$core.Deprecated('Use moveItemPayloadDescriptor instead') const MoveItemPayload$json = const { '1': 'MoveItemPayload', diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart index 3f0100c8d6..44798a9231 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart @@ -1,2 +1,3 @@ // Auto-generated, do not edit export './grid.pb.dart'; +export './field.pb.dart'; diff --git a/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs b/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs index 6cfa810ab9..ea19aa93df 100644 --- a/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs @@ -42,6 +42,7 @@ pub enum FolderEvent { DuplicateView = 205, CloseView = 206, ReadViewInfo = 207, + UpdateViewInfo = 208, CopyLink = 220, SetLatestView = 221, MoveFolderItem = 230, @@ -76,6 +77,7 @@ impl ::protobuf::ProtobufEnum for FolderEvent { 205 => ::std::option::Option::Some(FolderEvent::DuplicateView), 206 => ::std::option::Option::Some(FolderEvent::CloseView), 207 => ::std::option::Option::Some(FolderEvent::ReadViewInfo), + 208 => ::std::option::Option::Some(FolderEvent::UpdateViewInfo), 220 => ::std::option::Option::Some(FolderEvent::CopyLink), 221 => ::std::option::Option::Some(FolderEvent::SetLatestView), 230 => ::std::option::Option::Some(FolderEvent::MoveFolderItem), @@ -107,6 +109,7 @@ impl ::protobuf::ProtobufEnum for FolderEvent { FolderEvent::DuplicateView, FolderEvent::CloseView, FolderEvent::ReadViewInfo, + FolderEvent::UpdateViewInfo, FolderEvent::CopyLink, FolderEvent::SetLatestView, FolderEvent::MoveFolderItem, @@ -143,7 +146,7 @@ impl ::protobuf::reflect::ProtobufValue for FolderEvent { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0fevent_map.proto*\xd6\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\ + \n\x0fevent_map.proto*\xeb\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\ pace\x10\0\x12\x14\n\x10ReadCurWorkspace\x10\x01\x12\x12\n\x0eReadWorksp\ aces\x10\x02\x12\x13\n\x0fDeleteWorkspace\x10\x03\x12\x11\n\rOpenWorkspa\ ce\x10\x04\x12\x15\n\x11ReadWorkspaceApps\x10\x05\x12\r\n\tCreateApp\x10\ @@ -151,11 +154,12 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x10h\x12\x0f\n\nCreateView\x10\xc9\x01\x12\r\n\x08ReadView\x10\xca\x01\ \x12\x0f\n\nUpdateView\x10\xcb\x01\x12\x0f\n\nDeleteView\x10\xcc\x01\x12\ \x12\n\rDuplicateView\x10\xcd\x01\x12\x0e\n\tCloseView\x10\xce\x01\x12\ - \x11\n\x0cReadViewInfo\x10\xcf\x01\x12\r\n\x08CopyLink\x10\xdc\x01\x12\ - \x12\n\rSetLatestView\x10\xdd\x01\x12\x13\n\x0eMoveFolderItem\x10\xe6\ - \x01\x12\x0e\n\tReadTrash\x10\xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\ - \x02\x12\x10\n\x0bDeleteTrash\x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\ - \x10\xaf\x02\x12\x13\n\x0eDeleteAllTrash\x10\xb0\x02b\x06proto3\ + \x11\n\x0cReadViewInfo\x10\xcf\x01\x12\x13\n\x0eUpdateViewInfo\x10\xd0\ + \x01\x12\r\n\x08CopyLink\x10\xdc\x01\x12\x12\n\rSetLatestView\x10\xdd\ + \x01\x12\x13\n\x0eMoveFolderItem\x10\xe6\x01\x12\x0e\n\tReadTrash\x10\ + \xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\x02\x12\x10\n\x0bDeleteTrash\ + \x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\x10\xaf\x02\x12\x13\n\x0eDelet\ + eAllTrash\x10\xb0\x02b\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto b/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto index bb11f02509..db714c9ce7 100644 --- a/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto +++ b/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto @@ -18,6 +18,7 @@ enum FolderEvent { DuplicateView = 205; CloseView = 206; ReadViewInfo = 207; + UpdateViewInfo = 208; CopyLink = 220; SetLatestView = 221; MoveFolderItem = 230; diff --git a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs index 7f8e910424..88b36dd19b 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs @@ -259,26 +259,9 @@ impl ViewController { Ok(view_rev) } - #[tracing::instrument(level = "debug", skip(self, params), err)] - pub(crate) async fn update_view_info(&self, params: UpdateViewInfoParams) -> Result { - let changeset = ViewChangeset::new(params.clone()); - let view_id = changeset.id.clone(); - let view_rev = self - .persistence - .begin_transaction(|transaction| { - let _ = transaction.update_view(changeset)?; - let view_rev = transaction.read_view(&view_id)?; - let view: View = view_rev.clone().into(); - send_dart_notification(&view_id, FolderNotification::ViewUpdated) - .payload(view) - .send(); - let _ = notify_views_changed(&view_rev.belong_to_id, self.trash_controller.clone(), &transaction)?; - Ok(view_rev) - }) - .await?; - - let _ = self.update_view_on_server(params); - Ok(view_rev) + #[tracing::instrument(level = "debug", skip(self, _params), err)] + pub(crate) async fn update_view_info(&self, _params: UpdateViewInfoParams) -> Result<(), FlowyError> { + todo!() } pub(crate) async fn latest_visit_view(&self) -> FlowyResult> { diff --git a/frontend/rust-lib/flowy-grid/src/event_handler.rs b/frontend/rust-lib/flowy-grid/src/event_handler.rs index 7374515793..c27e7c2175 100644 --- a/frontend/rust-lib/flowy-grid/src/event_handler.rs +++ b/frontend/rust-lib/flowy-grid/src/event_handler.rs @@ -4,6 +4,7 @@ use crate::services::field::type_options::*; use crate::services::field::{default_type_option_builder_from_type, type_option_builder_from_json_str}; use flowy_error::{ErrorCode, FlowyError, FlowyResult}; use flowy_grid_data_model::entities::*; +use flowy_grid_data_model::revision::FieldRevision; use lib_dispatch::prelude::{data_result, AppData, Data, DataResult}; use std::sync::Arc; @@ -42,8 +43,8 @@ pub(crate) async fn get_fields_handler( let params: QueryFieldParams = data.into_inner().try_into()?; let editor = manager.get_grid_editor(¶ms.grid_id)?; let field_orders = params.field_orders.items; - let field_metas = editor.get_field_metas(Some(field_orders)).await?; - let repeated_field: RepeatedField = field_metas.into_iter().map(Field::from).collect::>().into(); + let field_revs = editor.get_field_revs(Some(field_orders)).await?; + let repeated_field: RepeatedField = field_revs.into_iter().map(Field::from).collect::>().into(); data_result(repeated_field) } @@ -105,15 +106,15 @@ pub(crate) async fn switch_to_field_handler( .await?; // Get the FieldMeta with field_id, if it doesn't exist, we create the default FieldMeta from the FieldType. - let field_meta = editor - .get_field_meta(¶ms.field_id) + let field_rev = editor + .get_field_rev(¶ms.field_id) .await - .unwrap_or(editor.next_field_meta(¶ms.field_type).await?); + .unwrap_or(editor.next_field_rev(¶ms.field_type).await?); - let type_option_data = get_type_option_data(&field_meta, ¶ms.field_type).await?; + let type_option_data = get_type_option_data(&field_rev, ¶ms.field_type).await?; let data = FieldTypeOptionData { grid_id: params.grid_id, - field: field_meta.into(), + field: field_rev.into(), type_option_data, }; @@ -139,13 +140,13 @@ pub(crate) async fn get_field_type_option_data_handler( ) -> DataResult { let params: EditFieldParams = data.into_inner().try_into()?; let editor = manager.get_grid_editor(¶ms.grid_id)?; - match editor.get_field_meta(¶ms.field_id).await { + match editor.get_field_rev(¶ms.field_id).await { None => Err(FlowyError::record_not_found()), - Some(field_meta) => { - let type_option_data = get_type_option_data(&field_meta, &field_meta.field_type).await?; + Some(field_rev) => { + let type_option_data = get_type_option_data(&field_rev, &field_rev.field_type).await?; let data = FieldTypeOptionData { grid_id: params.grid_id, - field: field_meta.into(), + field: field_rev.into(), type_option_data, }; data_result(data) @@ -161,12 +162,12 @@ pub(crate) async fn create_field_type_option_data_handler( ) -> DataResult { let params: CreateFieldParams = data.into_inner().try_into()?; let editor = manager.get_grid_editor(¶ms.grid_id)?; - let field_meta = editor.create_next_field_meta(¶ms.field_type).await?; - let type_option_data = get_type_option_data(&field_meta, &field_meta.field_type).await?; + let field_rev = editor.create_next_field_rev(¶ms.field_type).await?; + let type_option_data = get_type_option_data(&field_rev, &field_rev.field_type).await?; data_result(FieldTypeOptionData { grid_id: params.grid_id, - field: field_meta.into(), + field: field_rev.into(), type_option_data, }) } @@ -183,11 +184,11 @@ pub(crate) async fn move_item_handler( } /// The FieldMeta contains multiple data, each of them belongs to a specific FieldType. -async fn get_type_option_data(field_meta: &FieldMeta, field_type: &FieldType) -> FlowyResult> { - let s = field_meta +async fn get_type_option_data(field_rev: &FieldRevision, field_type: &FieldType) -> FlowyResult> { + let s = field_rev .get_type_option_str(field_type) .unwrap_or_else(|| default_type_option_builder_from_type(field_type).entry().json_str()); - let builder = type_option_builder_from_json_str(&s, &field_meta.field_type); + let builder = type_option_builder_from_json_str(&s, &field_rev.field_type); let type_option_data = builder.entry().protobuf_bytes().to_vec(); Ok(type_option_data) @@ -270,10 +271,10 @@ pub(crate) async fn new_select_option_handler( ) -> DataResult { let params: CreateSelectOptionParams = data.into_inner().try_into()?; let editor = manager.get_grid_editor(¶ms.grid_id)?; - match editor.get_field_meta(¶ms.field_id).await { + match editor.get_field_rev(¶ms.field_id).await { None => Err(ErrorCode::InvalidData.into()), - Some(field_meta) => { - let type_option = select_option_operation(&field_meta)?; + Some(field_rev) => { + let type_option = select_option_operation(&field_rev)?; let select_option = type_option.create_option(¶ms.option_name); data_result(select_option) } @@ -288,8 +289,8 @@ pub(crate) async fn update_select_option_handler( let changeset: SelectOptionChangeset = data.into_inner().try_into()?; let editor = manager.get_grid_editor(&changeset.cell_identifier.grid_id)?; - if let Some(mut field_meta) = editor.get_field_meta(&changeset.cell_identifier.field_id).await { - let mut type_option = select_option_operation(&field_meta)?; + if let Some(mut field_rev) = editor.get_field_rev(&changeset.cell_identifier.field_id).await { + let mut type_option = select_option_operation(&field_rev)?; let mut cell_content_changeset = None; if let Some(option) = changeset.insert_option { @@ -306,8 +307,8 @@ pub(crate) async fn update_select_option_handler( type_option.delete_option(option); } - field_meta.insert_type_option_entry(&*type_option); - let _ = editor.replace_field(field_meta).await?; + field_rev.insert_type_option_entry(&*type_option); + let _ = editor.replace_field(field_rev).await?; let changeset = CellChangeset { grid_id: changeset.cell_identifier.grid_id, @@ -327,15 +328,15 @@ pub(crate) async fn get_select_option_handler( ) -> DataResult { let params: CellIdentifier = data.into_inner().try_into()?; let editor = manager.get_grid_editor(¶ms.grid_id)?; - match editor.get_field_meta(¶ms.field_id).await { + match editor.get_field_rev(¶ms.field_id).await { None => { tracing::error!("Can't find the select option field with id: {}", params.field_id); data_result(SelectOptionCellData::default()) } - Some(field_meta) => { - let cell_meta = editor.get_cell_meta(¶ms.row_id, ¶ms.field_id).await?; - let type_option = select_option_operation(&field_meta)?; - let option_context = type_option.select_option_cell_data(&cell_meta); + Some(field_rev) => { + let cell_rev = editor.get_cell_rev(¶ms.row_id, ¶ms.field_id).await?; + let type_option = select_option_operation(&field_rev)?; + let option_context = type_option.select_option_cell_data(&cell_rev); data_result(option_context) } } diff --git a/frontend/rust-lib/flowy-grid/src/macros.rs b/frontend/rust-lib/flowy-grid/src/macros.rs index 79e0e106eb..5d670aa6c3 100644 --- a/frontend/rust-lib/flowy-grid/src/macros.rs +++ b/frontend/rust-lib/flowy-grid/src/macros.rs @@ -28,9 +28,9 @@ macro_rules! impl_builder_from_json_str_and_from_bytes { #[macro_export] macro_rules! impl_type_option { ($target: ident, $field_type:expr) => { - impl std::convert::From<&FieldMeta> for $target { - fn from(field_meta: &FieldMeta) -> $target { - match field_meta.get_type_option_entry::<$target>(&$field_type) { + impl std::convert::From<&FieldRevision> for $target { + fn from(field_rev: &FieldRevision) -> $target { + match field_rev.get_type_option_entry::<$target>(&$field_type) { None => $target::default(), Some(target) => target, } diff --git a/frontend/rust-lib/flowy-grid/src/manager.rs b/frontend/rust-lib/flowy-grid/src/manager.rs index 18ff4f654f..2b388677c4 100644 --- a/frontend/rust-lib/flowy-grid/src/manager.rs +++ b/frontend/rust-lib/flowy-grid/src/manager.rs @@ -6,7 +6,7 @@ use bytes::Bytes; use dashmap::DashMap; use flowy_database::ConnectionPool; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{BuildGridContext, GridMeta}; +use flowy_grid_data_model::revision::{BuildGridContext, GridRevision}; use flowy_revision::disk::{SQLiteGridBlockMetaRevisionPersistence, SQLiteGridRevisionPersistence}; use flowy_revision::{RevisionManager, RevisionPersistence, RevisionWebSocket}; use flowy_sync::client_grid::{make_block_meta_delta, make_grid_delta}; @@ -156,14 +156,14 @@ pub async fn make_grid_view_data( grid_manager: Arc, build_context: BuildGridContext, ) -> FlowyResult { - let grid_meta = GridMeta { + let grid_rev = GridRevision { grid_id: view_id.to_string(), - fields: build_context.field_metas, + fields: build_context.field_revs, blocks: build_context.blocks, }; // Create grid - let grid_meta_delta = make_grid_delta(&grid_meta); + let grid_meta_delta = make_grid_delta(&grid_rev); let grid_delta_data = grid_meta_delta.to_delta_bytes(); let repeated_revision: RepeatedRevision = Revision::initial_revision(user_id, view_id, grid_delta_data.clone()).into(); diff --git a/frontend/rust-lib/flowy-grid/src/services/block_meta_manager.rs b/frontend/rust-lib/flowy-grid/src/services/block_manager.rs similarity index 76% rename from frontend/rust-lib/flowy-grid/src/services/block_meta_manager.rs rename to frontend/rust-lib/flowy-grid/src/services/block_manager.rs index ec7c47f069..462f25e041 100644 --- a/frontend/rust-lib/flowy-grid/src/services/block_meta_manager.rs +++ b/frontend/rust-lib/flowy-grid/src/services/block_manager.rs @@ -1,13 +1,15 @@ use crate::dart_notification::{send_dart_notification, GridNotification}; use crate::manager::GridUser; -use crate::services::block_meta_editor::GridBlockMetaEditor; +use crate::services::block_revision_editor::GridBlockRevisionEditor; use crate::services::persistence::block_index::BlockIndexCache; use crate::services::row::{group_row_orders, GridBlockSnapshot}; use dashmap::DashMap; use flowy_error::FlowyResult; use flowy_grid_data_model::entities::{ - CellChangeset, CellMeta, GridBlockMeta, GridBlockMetaChangeset, GridRowsChangeset, IndexRowOrder, Row, RowMeta, - RowMetaChangeset, RowOrder, UpdatedRowOrder, + CellChangeset, GridRowsChangeset, IndexRowOrder, Row, RowOrder, UpdatedRowOrder, +}; +use flowy_grid_data_model::revision::{ + CellRevision, GridBlockRevision, GridBlockRevisionChangeset, RowMetaChangeset, RowRevision, }; use flowy_revision::disk::SQLiteGridBlockMetaRevisionPersistence; use flowy_revision::{RevisionManager, RevisionPersistence}; @@ -20,14 +22,14 @@ pub(crate) struct GridBlockManager { grid_id: String, user: Arc, persistence: Arc, - block_editor_map: DashMap>, + block_editor_map: DashMap>, } impl GridBlockManager { pub(crate) async fn new( grid_id: &str, user: &Arc, - blocks: Vec, + blocks: Vec, persistence: Arc, ) -> FlowyResult { let editor_map = make_block_meta_editor_map(user, blocks).await?; @@ -43,7 +45,7 @@ impl GridBlockManager { } // #[tracing::instrument(level = "trace", skip(self))] - pub(crate) async fn get_editor(&self, block_id: &str) -> FlowyResult> { + pub(crate) async fn get_editor(&self, block_id: &str) -> FlowyResult> { debug_assert!(!block_id.is_empty()); match self.block_editor_map.get(block_id) { None => { @@ -56,7 +58,7 @@ impl GridBlockManager { } } - async fn get_editor_from_row_id(&self, row_id: &str) -> FlowyResult> { + async fn get_editor_from_row_id(&self, row_id: &str) -> FlowyResult> { let block_id = self.persistence.get_block_id(row_id)?; Ok(self.get_editor(&block_id).await?) } @@ -64,14 +66,14 @@ impl GridBlockManager { pub(crate) async fn create_row( &self, block_id: &str, - row_meta: RowMeta, + row_rev: RowRevision, start_row_id: Option, ) -> FlowyResult { - let _ = self.persistence.insert(&row_meta.block_id, &row_meta.id)?; - let editor = self.get_editor(&row_meta.block_id).await?; + let _ = self.persistence.insert(&row_rev.block_id, &row_rev.id)?; + let editor = self.get_editor(&row_rev.block_id).await?; - let mut index_row_order = IndexRowOrder::from(&row_meta); - let (row_count, row_index) = editor.create_row(row_meta, start_row_id).await?; + let mut index_row_order = IndexRowOrder::from(&row_rev); + let (row_count, row_index) = editor.create_row(row_rev, start_row_id).await?; index_row_order.index = row_index; let _ = self @@ -82,14 +84,14 @@ impl GridBlockManager { pub(crate) async fn insert_row( &self, - rows_by_block_id: HashMap>, - ) -> FlowyResult> { + rows_by_block_id: HashMap>, + ) -> FlowyResult> { let mut changesets = vec![]; - for (block_id, row_metas) in rows_by_block_id { + for (block_id, row_revs) in rows_by_block_id { let mut inserted_row_orders = vec![]; let editor = self.get_editor(&block_id).await?; let mut row_count = 0; - for row in row_metas { + for row in row_revs { let _ = self.persistence.insert(&row.block_id, &row.id)?; let mut row_order = IndexRowOrder::from(&row); let (count, index) = editor.create_row(row, None).await?; @@ -97,7 +99,7 @@ impl GridBlockManager { row_order.index = index; inserted_row_orders.push(row_order); } - changesets.push(GridBlockMetaChangeset::from_row_count(&block_id, row_count)); + changesets.push(GridBlockRevisionChangeset::from_row_count(&block_id, row_count)); let _ = self .notify_did_update_block(GridRowsChangeset::insert(&block_id, inserted_row_orders)) @@ -109,15 +111,15 @@ impl GridBlockManager { pub async fn update_row(&self, changeset: RowMetaChangeset, row_builder: F) -> FlowyResult<()> where - F: FnOnce(Arc) -> Option, + F: FnOnce(Arc) -> Option, { let editor = self.get_editor_from_row_id(&changeset.row_id).await?; let _ = editor.update_row(changeset.clone()).await?; - match editor.get_row_meta(&changeset.row_id).await? { + match editor.get_row_rev(&changeset.row_id).await? { None => tracing::error!("Internal error: can't find the row with id: {}", changeset.row_id), - Some(row_meta) => { - if let Some(row) = row_builder(row_meta.clone()) { - let row_order = UpdatedRowOrder::new(&row_meta, row); + Some(row_rev) => { + if let Some(row) = row_builder(row_rev.clone()) { + let row_order = UpdatedRowOrder::new(&row_rev, row); let block_order_changeset = GridRowsChangeset::update(&editor.block_id, vec![row_order]); let _ = self.notify_did_update_block(block_order_changeset).await?; } @@ -143,7 +145,7 @@ impl GridBlockManager { Ok(()) } - pub(crate) async fn delete_rows(&self, row_orders: Vec) -> FlowyResult> { + pub(crate) async fn delete_rows(&self, row_orders: Vec) -> FlowyResult> { let mut changesets = vec![]; for block_order in group_row_orders(row_orders) { let editor = self.get_editor(&block_order.block_id).await?; @@ -153,7 +155,7 @@ impl GridBlockManager { .map(|row_order| Cow::Owned(row_order.row_id)) .collect::>>(); let row_count = editor.delete_rows(row_ids).await?; - let changeset = GridBlockMetaChangeset::from_row_count(&block_order.block_id, row_count); + let changeset = GridBlockRevisionChangeset::from_row_count(&block_order.block_id, row_count); changesets.push(changeset); } @@ -164,10 +166,10 @@ impl GridBlockManager { let editor = self.get_editor_from_row_id(row_id).await?; let _ = editor.move_row(row_id, from, to).await?; - match editor.get_row_metas(Some(vec![Cow::Borrowed(row_id)])).await?.pop() { + match editor.get_row_revs(Some(vec![Cow::Borrowed(row_id)])).await?.pop() { None => {} - Some(row_meta) => { - let row_order = RowOrder::from(&row_meta); + Some(row_rev) => { + let row_order = RowOrder::from(&row_rev); let insert_row = IndexRowOrder { row_order: row_order.clone(), index: Some(to as i32), @@ -188,7 +190,7 @@ impl GridBlockManager { pub async fn update_cell(&self, changeset: CellChangeset, row_builder: F) -> FlowyResult<()> where - F: FnOnce(Arc) -> Option, + F: FnOnce(Arc) -> Option, { let row_changeset: RowMetaChangeset = changeset.clone().into(); let _ = self.update_row(row_changeset, row_builder).await?; @@ -196,14 +198,14 @@ impl GridBlockManager { Ok(()) } - pub async fn get_row_meta(&self, row_id: &str) -> FlowyResult>> { + pub async fn get_row_rev(&self, row_id: &str) -> FlowyResult>> { let editor = self.get_editor_from_row_id(row_id).await?; let row_ids = vec![Cow::Borrowed(row_id)]; - let mut row_metas = editor.get_row_metas(Some(row_ids)).await?; - if row_metas.is_empty() { + let mut row_revs = editor.get_row_revs(Some(row_ids)).await?; + if row_revs.is_empty() { Ok(None) } else { - Ok(row_metas.pop()) + Ok(row_revs.pop()) } } @@ -216,27 +218,27 @@ impl GridBlockManager { let mut snapshots = vec![]; for block_id in block_ids { let editor = self.get_editor(&block_id).await?; - let row_metas = editor.get_row_metas::<&str>(None).await?; - snapshots.push(GridBlockSnapshot { block_id, row_metas }); + let row_revs = editor.get_row_revs::<&str>(None).await?; + snapshots.push(GridBlockSnapshot { block_id, row_revs }); } Ok(snapshots) } // Optimization: Using the shared memory(Arc, Cow,etc.) to reduce memory usage. #[allow(dead_code)] - pub async fn get_cell_metas( + pub async fn get_cell_revs( &self, block_ids: Vec, field_id: &str, row_ids: Option>>, - ) -> FlowyResult> { - let mut block_cell_metas = vec![]; + ) -> FlowyResult> { + let mut block_cell_revs = vec![]; for block_id in block_ids { let editor = self.get_editor(&block_id).await?; - let cell_metas = editor.get_cell_metas(field_id, row_ids.clone()).await?; - block_cell_metas.extend(cell_metas); + let cell_revs = editor.get_cell_revs(field_id, row_ids.clone()).await?; + block_cell_revs.extend(cell_revs); } - Ok(block_cell_metas) + Ok(block_cell_revs) } async fn notify_did_update_block(&self, changeset: GridRowsChangeset) -> FlowyResult<()> { @@ -255,8 +257,8 @@ impl GridBlockManager { async fn make_block_meta_editor_map( user: &Arc, - blocks: Vec, -) -> FlowyResult>> { + blocks: Vec, +) -> FlowyResult>> { let editor_map = DashMap::new(); for block in blocks { let editor = make_block_meta_editor(user, &block.block_id).await?; @@ -266,7 +268,7 @@ async fn make_block_meta_editor_map( Ok(editor_map) } -async fn make_block_meta_editor(user: &Arc, block_id: &str) -> FlowyResult { +async fn make_block_meta_editor(user: &Arc, block_id: &str) -> FlowyResult { tracing::trace!("Open block:{} meta editor", block_id); let token = user.token()?; let user_id = user.user_id()?; @@ -275,5 +277,5 @@ async fn make_block_meta_editor(user: &Arc, block_id: &str) -> Flo let disk_cache = Arc::new(SQLiteGridBlockMetaRevisionPersistence::new(&user_id, pool)); let rev_persistence = Arc::new(RevisionPersistence::new(&user_id, block_id, disk_cache)); let rev_manager = RevisionManager::new(&user_id, block_id, rev_persistence); - GridBlockMetaEditor::new(&user_id, &token, block_id, rev_manager).await + GridBlockRevisionEditor::new(&user_id, &token, block_id, rev_manager).await } diff --git a/frontend/rust-lib/flowy-grid/src/services/block_meta_editor.rs b/frontend/rust-lib/flowy-grid/src/services/block_revision_editor.rs similarity index 81% rename from frontend/rust-lib/flowy-grid/src/services/block_meta_editor.rs rename to frontend/rust-lib/flowy-grid/src/services/block_revision_editor.rs index d37c869156..e7f4c14d32 100644 --- a/frontend/rust-lib/flowy-grid/src/services/block_meta_editor.rs +++ b/frontend/rust-lib/flowy-grid/src/services/block_revision_editor.rs @@ -1,8 +1,9 @@ use bytes::Bytes; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{CellMeta, GridBlockMetaData, RowMeta, RowMetaChangeset, RowOrder}; +use flowy_grid_data_model::entities::RowOrder; +use flowy_grid_data_model::revision::{CellRevision, GridBlockRevisionData, RowMetaChangeset, RowRevision}; use flowy_revision::{RevisionCloudService, RevisionCompactor, RevisionManager, RevisionObjectBuilder}; -use flowy_sync::client_grid::{GridBlockMetaChange, GridBlockMetaPad}; +use flowy_sync::client_grid::{GridBlockMetaChange, GridBlockRevisionPad}; use flowy_sync::entities::revision::Revision; use flowy_sync::util::make_delta_from_revisions; use lib_infra::future::FutureResult; @@ -11,14 +12,14 @@ use std::borrow::Cow; use std::sync::Arc; use tokio::sync::RwLock; -pub struct GridBlockMetaEditor { +pub struct GridBlockRevisionEditor { user_id: String, pub block_id: String, - pad: Arc>, + pad: Arc>, rev_manager: Arc, } -impl GridBlockMetaEditor { +impl GridBlockRevisionEditor { pub async fn new( user_id: &str, token: &str, @@ -41,14 +42,14 @@ impl GridBlockMetaEditor { }) } - pub async fn duplicate_block_meta_data(&self, duplicated_block_id: &str) -> GridBlockMetaData { + pub async fn duplicate_block_meta_data(&self, duplicated_block_id: &str) -> GridBlockRevisionData { self.pad.read().await.duplicate_data(duplicated_block_id).await } /// return current number of rows and the inserted index. The inserted index will be None if the start_row_id is None pub(crate) async fn create_row( &self, - row: RowMeta, + row: RowRevision, start_row_id: Option, ) -> FlowyResult<(i32, Option)> { let mut row_count = 0; @@ -62,7 +63,7 @@ impl GridBlockMetaEditor { } } - let change = block_pad.add_row_meta(row, start_row_id)?; + let change = block_pad.add_row_rev(row, start_row_id)?; row_count = block_pad.number_of_rows(); if row_index.is_none() { @@ -99,27 +100,27 @@ impl GridBlockMetaEditor { Ok(()) } - pub async fn get_row_meta(&self, row_id: &str) -> FlowyResult>> { + pub async fn get_row_rev(&self, row_id: &str) -> FlowyResult>> { let row_ids = vec![Cow::Borrowed(row_id)]; - let row_meta = self.get_row_metas(Some(row_ids)).await?.pop(); - Ok(row_meta) + let row_rev = self.get_row_revs(Some(row_ids)).await?.pop(); + Ok(row_rev) } - pub async fn get_row_metas(&self, row_ids: Option>>) -> FlowyResult>> + pub async fn get_row_revs(&self, row_ids: Option>>) -> FlowyResult>> where T: AsRef + ToOwned + ?Sized, { - let row_metas = self.pad.read().await.get_row_metas(row_ids)?; - Ok(row_metas) + let row_revs = self.pad.read().await.get_row_revs(row_ids)?; + Ok(row_revs) } - pub async fn get_cell_metas( + pub async fn get_cell_revs( &self, field_id: &str, row_ids: Option>>, - ) -> FlowyResult> { - let cell_metas = self.pad.read().await.get_cell_metas(field_id, row_ids)?; - Ok(cell_metas) + ) -> FlowyResult> { + let cell_revs = self.pad.read().await.get_cell_revs(field_id, row_ids)?; + Ok(cell_revs) } pub async fn get_row_order(&self, row_id: &str) -> FlowyResult> { @@ -135,7 +136,7 @@ impl GridBlockMetaEditor { .pad .read() .await - .get_row_metas(row_ids)? + .get_row_revs(row_ids)? .iter() .map(RowOrder::from) .collect::>(); @@ -144,7 +145,7 @@ impl GridBlockMetaEditor { async fn modify(&self, f: F) -> FlowyResult<()> where - F: for<'a> FnOnce(&'a mut GridBlockMetaPad) -> FlowyResult>, + F: for<'a> FnOnce(&'a mut GridBlockRevisionPad) -> FlowyResult>, { let mut write_guard = self.pad.write().await; match f(&mut *write_guard)? { @@ -191,10 +192,10 @@ impl RevisionCloudService for GridBlockMetaRevisionCloudService { struct GridBlockMetaPadBuilder(); impl RevisionObjectBuilder for GridBlockMetaPadBuilder { - type Output = GridBlockMetaPad; + type Output = GridBlockRevisionPad; fn build_object(object_id: &str, revisions: Vec) -> FlowyResult { - let pad = GridBlockMetaPad::from_revisions(object_id, revisions)?; + let pad = GridBlockRevisionPad::from_revisions(object_id, revisions)?; Ok(pad) } } diff --git a/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs b/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs index 7978323be1..12b665a62b 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs @@ -1,10 +1,11 @@ use crate::services::field::type_options::*; use bytes::Bytes; -use flowy_grid_data_model::entities::{Field, FieldMeta, FieldType, TypeOptionDataEntry}; +use flowy_grid_data_model::entities::{Field, FieldType}; +use flowy_grid_data_model::revision::{FieldRevision, TypeOptionDataEntry}; use indexmap::IndexMap; pub struct FieldBuilder { - field_meta: FieldMeta, + field_rev: FieldRevision, type_option_builder: Box, } @@ -13,9 +14,9 @@ pub type BoxTypeOptionBuilder = Box; impl FieldBuilder { pub fn new>(type_option_builder: T) -> Self { let type_option_builder = type_option_builder.into(); - let field_meta = FieldMeta::new("", "", type_option_builder.field_type(), false); + let field_rev = FieldRevision::new("", "", type_option_builder.field_type(), false); Self { - field_meta, + field_rev, type_option_builder, } } @@ -26,7 +27,7 @@ impl FieldBuilder { } pub fn from_field(field: Field, type_option_builder: Box) -> Self { - let field_meta = FieldMeta { + let field_rev = FieldRevision { id: field.id, name: field.name, desc: field.desc, @@ -38,46 +39,46 @@ impl FieldBuilder { is_primary: field.is_primary, }; Self { - field_meta, + field_rev, type_option_builder, } } pub fn name(mut self, name: &str) -> Self { - self.field_meta.name = name.to_owned(); + self.field_rev.name = name.to_owned(); self } pub fn desc(mut self, desc: &str) -> Self { - self.field_meta.desc = desc.to_owned(); + self.field_rev.desc = desc.to_owned(); self } pub fn primary(mut self, is_primary: bool) -> Self { - self.field_meta.is_primary = is_primary; + self.field_rev.is_primary = is_primary; self } pub fn visibility(mut self, visibility: bool) -> Self { - self.field_meta.visibility = visibility; + self.field_rev.visibility = visibility; self } pub fn width(mut self, width: i32) -> Self { - self.field_meta.width = width; + self.field_rev.width = width; self } pub fn frozen(mut self, frozen: bool) -> Self { - self.field_meta.frozen = frozen; + self.field_rev.frozen = frozen; self } - pub fn build(self) -> FieldMeta { - debug_assert_eq!(self.field_meta.field_type, self.type_option_builder.field_type()); - let mut field_meta = self.field_meta; - field_meta.insert_type_option_entry(self.type_option_builder.entry()); - field_meta + pub fn build(self) -> FieldRevision { + debug_assert_eq!(self.field_rev.field_type, self.type_option_builder.field_type()); + let mut field_rev = self.field_rev; + field_rev.insert_type_option_entry(self.type_option_builder.entry()); + field_rev } } diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs index 995a0e5e33..d20956a985 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs @@ -4,10 +4,8 @@ use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellD use bytes::Bytes; use flowy_derive::ProtoBuf; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{ - CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry, -}; - +use flowy_grid_data_model::entities::FieldType; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision, TypeOptionDataDeserializer, TypeOptionDataEntry}; use serde::{Deserialize, Serialize}; #[derive(Default)] @@ -47,7 +45,7 @@ impl CellDataOperation for CheckboxTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - _field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into, @@ -64,7 +62,7 @@ impl CellDataOperation for CheckboxTypeOption { Ok(DecodedCellData::default()) } - fn apply_changeset(&self, changeset: C, _cell_meta: Option) -> Result + fn apply_changeset(&self, changeset: C, _cell_rev: Option) -> Result where C: Into, { @@ -101,40 +99,40 @@ mod tests { #[test] fn checkout_box_description_test() { - let field_meta = FieldBuilder::from_field_type(&FieldType::Checkbox).build(); - let data = apply_cell_data_changeset("true", None, &field_meta).unwrap(); + let field_rev = FieldBuilder::from_field_type(&FieldType::Checkbox).build(); + let data = apply_cell_data_changeset("true", None, &field_rev).unwrap(); assert_eq!( - decode_cell_data_from_type_option_cell_data(data, &field_meta, &field_meta.field_type).to_string(), + decode_cell_data_from_type_option_cell_data(data, &field_rev, &field_rev.field_type).to_string(), YES ); - let data = apply_cell_data_changeset("1", None, &field_meta).unwrap(); + let data = apply_cell_data_changeset("1", None, &field_rev).unwrap(); assert_eq!( - decode_cell_data_from_type_option_cell_data(data, &field_meta, &field_meta.field_type).to_string(), + decode_cell_data_from_type_option_cell_data(data, &field_rev, &field_rev.field_type).to_string(), YES ); - let data = apply_cell_data_changeset("yes", None, &field_meta).unwrap(); + let data = apply_cell_data_changeset("yes", None, &field_rev).unwrap(); assert_eq!( - decode_cell_data_from_type_option_cell_data(data, &field_meta, &field_meta.field_type).to_string(), + decode_cell_data_from_type_option_cell_data(data, &field_rev, &field_rev.field_type).to_string(), YES ); - let data = apply_cell_data_changeset("false", None, &field_meta).unwrap(); + let data = apply_cell_data_changeset("false", None, &field_rev).unwrap(); assert_eq!( - decode_cell_data_from_type_option_cell_data(data, &field_meta, &field_meta.field_type).to_string(), + decode_cell_data_from_type_option_cell_data(data, &field_rev, &field_rev.field_type).to_string(), NO ); - let data = apply_cell_data_changeset("no", None, &field_meta).unwrap(); + let data = apply_cell_data_changeset("no", None, &field_rev).unwrap(); assert_eq!( - decode_cell_data_from_type_option_cell_data(data, &field_meta, &field_meta.field_type).to_string(), + decode_cell_data_from_type_option_cell_data(data, &field_rev, &field_rev.field_type).to_string(), NO ); - let data = apply_cell_data_changeset("12", None, &field_meta).unwrap(); + let data = apply_cell_data_changeset("12", None, &field_rev).unwrap(); assert_eq!( - decode_cell_data_from_type_option_cell_data(data, &field_meta, &field_meta.field_type).to_string(), + decode_cell_data_from_type_option_cell_data(data, &field_rev, &field_rev.field_type).to_string(), NO ); } diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs index 4a64fc3eca..2a5ffaf1cd 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs @@ -7,9 +7,8 @@ use chrono::format::strftime::StrftimeItems; use chrono::{NaiveDateTime, Timelike}; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use flowy_error::{ErrorCode, FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{ - CellChangeset, CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry, -}; +use flowy_grid_data_model::entities::{CellChangeset, FieldType}; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision, TypeOptionDataDeserializer, TypeOptionDataEntry}; use serde::{Deserialize, Serialize}; use strum_macros::EnumIter; @@ -121,7 +120,7 @@ impl CellDataOperation for DateTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - _field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into, @@ -139,7 +138,7 @@ impl CellDataOperation for DateTypeOption { DecodedCellData::try_from_bytes(date) } - fn apply_changeset(&self, changeset: C, _cell_meta: Option) -> Result + fn apply_changeset(&self, changeset: C, _cell_rev: Option) -> Result where C: Into, { @@ -358,14 +357,15 @@ mod tests { use crate::services::field::FieldBuilder; use crate::services::field::{DateCellContentChangeset, DateCellData, DateFormat, DateTypeOption, TimeFormat}; use crate::services::row::CellDataOperation; - use flowy_grid_data_model::entities::{FieldMeta, FieldType, TypeOptionDataEntry}; + use flowy_grid_data_model::entities::FieldType; + use flowy_grid_data_model::revision::{FieldRevision, TypeOptionDataEntry}; use strum::IntoEnumIterator; #[test] fn date_type_option_invalid_input_test() { let type_option = DateTypeOption::default(); let field_type = FieldType::DateTime; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); assert_changeset_result( &type_option, DateCellContentChangeset { @@ -373,7 +373,7 @@ mod tests { time: Some("23:00".to_owned()), }, &field_type, - &field_meta, + &field_rev, "", ); } @@ -381,21 +381,21 @@ mod tests { #[test] fn date_type_option_date_format_test() { let mut type_option = DateTypeOption::default(); - let field_meta = FieldBuilder::from_field_type(&FieldType::DateTime).build(); + let field_rev = FieldBuilder::from_field_type(&FieldType::DateTime).build(); for date_format in DateFormat::iter() { type_option.date_format = date_format; match date_format { DateFormat::Friendly => { - assert_decode_timestamp(1647251762, &type_option, &field_meta, "Mar 14,2022"); + assert_decode_timestamp(1647251762, &type_option, &field_rev, "Mar 14,2022"); } DateFormat::US => { - assert_decode_timestamp(1647251762, &type_option, &field_meta, "2022/03/14"); + assert_decode_timestamp(1647251762, &type_option, &field_rev, "2022/03/14"); } DateFormat::ISO => { - assert_decode_timestamp(1647251762, &type_option, &field_meta, "2022-03-14"); + assert_decode_timestamp(1647251762, &type_option, &field_rev, "2022-03-14"); } DateFormat::Local => { - assert_decode_timestamp(1647251762, &type_option, &field_meta, "2022/03/14"); + assert_decode_timestamp(1647251762, &type_option, &field_rev, "2022/03/14"); } } } @@ -405,7 +405,7 @@ mod tests { fn date_type_option_time_format_test() { let mut type_option = DateTypeOption::default(); let field_type = FieldType::DateTime; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); for time_format in TimeFormat::iter() { type_option.time_format = time_format; @@ -419,7 +419,7 @@ mod tests { time: None, }, &field_type, - &field_meta, + &field_rev, "May 27,2022", ); assert_changeset_result( @@ -429,7 +429,7 @@ mod tests { time: Some("23:00".to_owned()), }, &field_type, - &field_meta, + &field_rev, "May 27,2022 23:00", ); } @@ -441,7 +441,7 @@ mod tests { time: None, }, &field_type, - &field_meta, + &field_rev, "May 27,2022", ); // @@ -452,7 +452,7 @@ mod tests { time: Some("".to_owned()), }, &field_type, - &field_meta, + &field_rev, "May 27,2022", ); @@ -463,7 +463,7 @@ mod tests { time: Some("11:23 pm".to_owned()), }, &field_type, - &field_meta, + &field_rev, "May 27,2022 11:23 PM", ); } @@ -475,7 +475,7 @@ mod tests { fn date_type_option_apply_changeset_test() { let mut type_option = DateTypeOption::new(); let field_type = FieldType::DateTime; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); let date_timestamp = "1653609600".to_owned(); assert_changeset_result( @@ -485,7 +485,7 @@ mod tests { time: None, }, &field_type, - &field_meta, + &field_rev, "May 27,2022", ); @@ -497,7 +497,7 @@ mod tests { time: None, }, &field_type, - &field_meta, + &field_rev, "May 27,2022", ); @@ -508,7 +508,7 @@ mod tests { time: Some("1:00".to_owned()), }, &field_type, - &field_meta, + &field_rev, "May 27,2022 01:00", ); @@ -520,7 +520,7 @@ mod tests { time: Some("1:00 am".to_owned()), }, &field_type, - &field_meta, + &field_rev, "May 27,2022 01:00 AM", ); } @@ -530,7 +530,7 @@ mod tests { fn date_type_option_apply_changeset_error_test() { let mut type_option = DateTypeOption::new(); type_option.include_time = true; - let field_meta = FieldBuilder::from_field_type(&type_option.field_type()).build(); + let field_rev = FieldBuilder::from_field_type(&type_option.field_type()).build(); let date_timestamp = "1653609600".to_owned(); assert_changeset_result( @@ -540,7 +540,7 @@ mod tests { time: Some("1:".to_owned()), }, &type_option.field_type(), - &field_meta, + &field_rev, "May 27,2022 01:00", ); @@ -551,7 +551,7 @@ mod tests { time: Some("1:00".to_owned()), }, &type_option.field_type(), - &field_meta, + &field_rev, "May 27,2022 01:00", ); } @@ -561,7 +561,7 @@ mod tests { fn date_type_option_twelve_hours_to_twenty_four_hours() { let mut type_option = DateTypeOption::new(); type_option.include_time = true; - let field_meta = FieldBuilder::from_field_type(&type_option.field_type()).build(); + let field_rev = FieldBuilder::from_field_type(&type_option.field_type()).build(); let date_timestamp = "1653609600".to_owned(); assert_changeset_result( @@ -571,7 +571,7 @@ mod tests { time: Some("1:00 am".to_owned()), }, &type_option.field_type(), - &field_meta, + &field_rev, "May 27,2022 01:00", ); } @@ -580,17 +580,22 @@ mod tests { type_option: &DateTypeOption, changeset: DateCellContentChangeset, _field_type: &FieldType, - field_meta: &FieldMeta, + field_rev: &FieldRevision, expected: &str, ) { let encoded_data = type_option.apply_changeset(changeset, None).unwrap(); assert_eq!( expected.to_owned(), - decode_cell_data(encoded_data, type_option, field_meta) + decode_cell_data(encoded_data, type_option, field_rev) ); } - fn assert_decode_timestamp(timestamp: i64, type_option: &DateTypeOption, field_meta: &FieldMeta, expected: &str) { + fn assert_decode_timestamp( + timestamp: i64, + type_option: &DateTypeOption, + field_rev: &FieldRevision, + expected: &str, + ) { let encoded_data = type_option .apply_changeset( DateCellContentChangeset { @@ -603,17 +608,17 @@ mod tests { assert_eq!( expected.to_owned(), - decode_cell_data(encoded_data, type_option, field_meta) + decode_cell_data(encoded_data, type_option, field_rev) ); } fn decode_cell_data>( encoded_data: T, type_option: &DateTypeOption, - field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> String { let decoded_data = type_option - .decode_cell_data(encoded_data, &FieldType::DateTime, field_meta) + .decode_cell_data(encoded_data, &FieldType::DateTime, field_rev) .unwrap() .parse::() .unwrap(); diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs index 9c830797ed..72a15f1949 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs @@ -6,11 +6,9 @@ use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellD use bytes::Bytes; use flowy_derive::ProtoBuf; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{ - CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry, -}; +use flowy_grid_data_model::entities::FieldType; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision, TypeOptionDataDeserializer, TypeOptionDataEntry}; use rust_decimal::Decimal; - use serde::{Deserialize, Serialize}; use std::str::FromStr; @@ -146,7 +144,7 @@ impl CellDataOperation for NumberTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - _field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into, @@ -181,7 +179,7 @@ impl CellDataOperation for NumberTypeOption { } } - fn apply_changeset(&self, changeset: C, _cell_meta: Option) -> Result + fn apply_changeset(&self, changeset: C, _cell_rev: Option) -> Result where C: Into, { @@ -211,16 +209,17 @@ mod tests { use crate::services::field::FieldBuilder; use crate::services::field::{NumberFormat, NumberTypeOption}; use crate::services::row::CellDataOperation; - use flowy_grid_data_model::entities::{FieldMeta, FieldType}; + use flowy_grid_data_model::entities::FieldType; + use flowy_grid_data_model::revision::FieldRevision; use strum::IntoEnumIterator; #[test] fn number_type_option_invalid_input_test() { let type_option = NumberTypeOption::default(); let field_type = FieldType::Number; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); - assert_equal(&type_option, "", "", &field_type, &field_meta); - assert_equal(&type_option, "abc", "", &field_type, &field_meta); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); + assert_equal(&type_option, "", "", &field_type, &field_rev); + assert_equal(&type_option, "abc", "", &field_type, &field_rev); } #[test] @@ -237,25 +236,25 @@ mod tests { fn number_type_option_format_number_test() { let mut type_option = NumberTypeOption::default(); let field_type = FieldType::Number; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); for format in NumberFormat::iter() { type_option.format = format; match format { NumberFormat::Number => { - assert_equal(&type_option, "18443", "18443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "18443", &field_type, &field_rev); } NumberFormat::USD => { - assert_equal(&type_option, "18443", "$18,443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "$18,443", &field_type, &field_rev); } NumberFormat::Yen => { - assert_equal(&type_option, "18443", "¥18,443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "¥18,443", &field_type, &field_rev); } NumberFormat::Yuan => { - assert_equal(&type_option, "18443", "CN¥18,443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "CN¥18,443", &field_type, &field_rev); } NumberFormat::EUR => { - assert_equal(&type_option, "18443", "€18.443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "€18.443", &field_type, &field_rev); } _ => {} } @@ -266,33 +265,33 @@ mod tests { fn number_type_option_format_str_test() { let mut type_option = NumberTypeOption::default(); let field_type = FieldType::Number; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); for format in NumberFormat::iter() { type_option.format = format; match format { NumberFormat::Number => { - assert_equal(&type_option, "18443", "18443", &field_type, &field_meta); - assert_equal(&type_option, "0.2", "0.2", &field_type, &field_meta); + assert_equal(&type_option, "18443", "18443", &field_type, &field_rev); + assert_equal(&type_option, "0.2", "0.2", &field_type, &field_rev); } NumberFormat::USD => { - assert_equal(&type_option, "$18,44", "$1,844", &field_type, &field_meta); - assert_equal(&type_option, "$0.2", "$0.2", &field_type, &field_meta); - assert_equal(&type_option, "", "", &field_type, &field_meta); - assert_equal(&type_option, "abc", "", &field_type, &field_meta); + assert_equal(&type_option, "$18,44", "$1,844", &field_type, &field_rev); + assert_equal(&type_option, "$0.2", "$0.2", &field_type, &field_rev); + assert_equal(&type_option, "", "", &field_type, &field_rev); + assert_equal(&type_option, "abc", "", &field_type, &field_rev); } NumberFormat::Yen => { - assert_equal(&type_option, "¥18,44", "¥1,844", &field_type, &field_meta); - assert_equal(&type_option, "¥1844", "¥1,844", &field_type, &field_meta); + assert_equal(&type_option, "¥18,44", "¥1,844", &field_type, &field_rev); + assert_equal(&type_option, "¥1844", "¥1,844", &field_type, &field_rev); } NumberFormat::Yuan => { - assert_equal(&type_option, "CN¥18,44", "CN¥1,844", &field_type, &field_meta); - assert_equal(&type_option, "CN¥1844", "CN¥1,844", &field_type, &field_meta); + assert_equal(&type_option, "CN¥18,44", "CN¥1,844", &field_type, &field_rev); + assert_equal(&type_option, "CN¥1844", "CN¥1,844", &field_type, &field_rev); } NumberFormat::EUR => { - assert_equal(&type_option, "€18.44", "€18,44", &field_type, &field_meta); - assert_equal(&type_option, "€0.5", "€0,5", &field_type, &field_meta); - assert_equal(&type_option, "€1844", "€1.844", &field_type, &field_meta); + assert_equal(&type_option, "€18.44", "€18,44", &field_type, &field_rev); + assert_equal(&type_option, "€0.5", "€0,5", &field_type, &field_rev); + assert_equal(&type_option, "€1844", "€1.844", &field_type, &field_rev); } _ => {} } @@ -306,22 +305,22 @@ mod tests { ..Default::default() }; let field_type = FieldType::Number; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); for format in NumberFormat::iter() { type_option.format = format; match format { NumberFormat::Number => { - assert_equal(&type_option, "18443", "18443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "18443", &field_type, &field_rev); } NumberFormat::USD => { - assert_equal(&type_option, "18443", "-$18,443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "-$18,443", &field_type, &field_rev); } NumberFormat::Yen => { - assert_equal(&type_option, "18443", "-¥18,443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "-¥18,443", &field_type, &field_rev); } NumberFormat::EUR => { - assert_equal(&type_option, "18443", "-€18.443", &field_type, &field_meta); + assert_equal(&type_option, "18443", "-€18.443", &field_type, &field_rev); } _ => {} } @@ -333,11 +332,11 @@ mod tests { cell_data: &str, expected_str: &str, field_type: &FieldType, - field_meta: &FieldMeta, + field_rev: &FieldRevision, ) { assert_eq!( type_option - .decode_cell_data(cell_data, field_type, field_meta) + .decode_cell_data(cell_data, field_type, field_rev) .unwrap() .to_string(), expected_str.to_owned() diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs index a7ad30cc31..5bbcdc513c 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs @@ -6,10 +6,9 @@ use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellD use bytes::Bytes; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use flowy_error::{ErrorCode, FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{ - CellChangeset, CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry, -}; +use flowy_grid_data_model::entities::{CellChangeset, FieldType}; use flowy_grid_data_model::parser::NotEmptyStr; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision, TypeOptionDataDeserializer, TypeOptionDataEntry}; use nanoid::nanoid; use serde::{Deserialize, Serialize}; use std::str::FromStr; @@ -42,21 +41,21 @@ pub trait SelectOptionOperation: TypeOptionDataEntry + Send + Sync { SelectOption::with_color(name, color) } - fn select_option_cell_data(&self, cell_meta: &Option) -> SelectOptionCellData; + fn select_option_cell_data(&self, cell_rev: &Option) -> SelectOptionCellData; fn options(&self) -> &Vec; fn mut_options(&mut self) -> &mut Vec; } -pub fn select_option_operation(field_meta: &FieldMeta) -> FlowyResult> { - match &field_meta.field_type { +pub fn select_option_operation(field_rev: &FieldRevision) -> FlowyResult> { + match &field_rev.field_type { FieldType::SingleSelect => { - let type_option = SingleSelectTypeOption::from(field_meta); + let type_option = SingleSelectTypeOption::from(field_rev); Ok(Box::new(type_option)) } FieldType::MultiSelect => { - let type_option = MultiSelectTypeOption::from(field_meta); + let type_option = MultiSelectTypeOption::from(field_rev); Ok(Box::new(type_option)) } ty => { @@ -78,8 +77,8 @@ pub struct SingleSelectTypeOption { impl_type_option!(SingleSelectTypeOption, FieldType::SingleSelect); impl SelectOptionOperation for SingleSelectTypeOption { - fn select_option_cell_data(&self, cell_meta: &Option) -> SelectOptionCellData { - let select_options = make_select_context_from(cell_meta, &self.options); + fn select_option_cell_data(&self, cell_rev: &Option) -> SelectOptionCellData { + let select_options = make_select_context_from(cell_rev, &self.options); SelectOptionCellData { options: self.options.clone(), select_options, @@ -100,7 +99,7 @@ impl CellDataOperation for SingleSelectTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - _field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into, @@ -123,7 +122,7 @@ impl CellDataOperation for SingleSelectTypeOption { DecodedCellData::try_from_bytes(cell_data) } - fn apply_changeset(&self, changeset: C, _cell_meta: Option) -> Result + fn apply_changeset(&self, changeset: C, _cell_rev: Option) -> Result where C: Into, { @@ -176,8 +175,8 @@ pub struct MultiSelectTypeOption { impl_type_option!(MultiSelectTypeOption, FieldType::MultiSelect); impl SelectOptionOperation for MultiSelectTypeOption { - fn select_option_cell_data(&self, cell_meta: &Option) -> SelectOptionCellData { - let select_options = make_select_context_from(cell_meta, &self.options); + fn select_option_cell_data(&self, cell_rev: &Option) -> SelectOptionCellData { + let select_options = make_select_context_from(cell_rev, &self.options); SelectOptionCellData { options: self.options.clone(), select_options, @@ -198,7 +197,7 @@ impl CellDataOperation for MultiSelectTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - _field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into, @@ -221,18 +220,18 @@ impl CellDataOperation for MultiSelectTypeOption { DecodedCellData::try_from_bytes(cell_data) } - fn apply_changeset(&self, changeset: T, cell_meta: Option) -> Result + fn apply_changeset(&self, changeset: T, cell_rev: Option) -> Result where T: Into, { let content_changeset: SelectOptionCellContentChangeset = serde_json::from_str(&changeset.into())?; let new_cell_data: String; - match cell_meta { + match cell_rev { None => { new_cell_data = content_changeset.insert_option_id.unwrap_or_else(|| "".to_owned()); } - Some(cell_meta) => { - let cell_data = get_cell_data(&cell_meta); + Some(cell_rev) => { + let cell_data = get_cell_data(&cell_rev); let mut selected_options = select_option_ids(cell_data); if let Some(insert_option_id) = content_changeset.insert_option_id { tracing::trace!("Insert multi select option: {}", &insert_option_id); @@ -485,11 +484,11 @@ impl std::default::Default for SelectOptionColor { } } -fn make_select_context_from(cell_meta: &Option, options: &[SelectOption]) -> Vec { - match cell_meta { +fn make_select_context_from(cell_rev: &Option, options: &[SelectOption]) -> Vec { + match cell_rev { None => vec![], - Some(cell_meta) => { - if let Ok(type_option_cell_data) = TypeOptionCellData::from_str(&cell_meta.data) { + Some(cell_rev) => { + if let Ok(type_option_cell_data) = TypeOptionCellData::from_str(&cell_rev.data) { select_option_ids(type_option_cell_data.data) .into_iter() .flat_map(|option_id| options.iter().find(|option| option.id == option_id).cloned()) @@ -509,7 +508,7 @@ mod tests { SelectOptionCellData, SingleSelectTypeOption, SingleSelectTypeOptionBuilder, SELECTION_IDS_SEPARATOR, }; use crate::services::row::CellDataOperation; - use flowy_grid_data_model::entities::FieldMeta; + use flowy_grid_data_model::revision::FieldRevision; #[test] fn single_select_test() { @@ -521,34 +520,34 @@ mod tests { .option(facebook_option.clone()) .option(twitter_option); - let field_meta = FieldBuilder::new(single_select) + let field_rev = FieldBuilder::new(single_select) .name("Platform") .visibility(true) .build(); - let type_option = SingleSelectTypeOption::from(&field_meta); + let type_option = SingleSelectTypeOption::from(&field_rev); let option_ids = vec![google_option.id.clone(), facebook_option.id].join(SELECTION_IDS_SEPARATOR); let data = SelectOptionCellContentChangeset::from_insert(&option_ids).to_str(); let cell_data = type_option.apply_changeset(data, None).unwrap(); - assert_single_select_options(cell_data, &type_option, &field_meta, vec![google_option.clone()]); + assert_single_select_options(cell_data, &type_option, &field_rev, vec![google_option.clone()]); let data = SelectOptionCellContentChangeset::from_insert(&google_option.id).to_str(); let cell_data = type_option.apply_changeset(data, None).unwrap(); - assert_single_select_options(cell_data, &type_option, &field_meta, vec![google_option]); + assert_single_select_options(cell_data, &type_option, &field_rev, vec![google_option]); // Invalid option id let cell_data = type_option .apply_changeset(SelectOptionCellContentChangeset::from_insert("").to_str(), None) .unwrap(); - assert_single_select_options(cell_data, &type_option, &field_meta, vec![]); + assert_single_select_options(cell_data, &type_option, &field_rev, vec![]); // Invalid option id let cell_data = type_option .apply_changeset(SelectOptionCellContentChangeset::from_insert("123").to_str(), None) .unwrap(); - assert_single_select_options(cell_data, &type_option, &field_meta, vec![]); + assert_single_select_options(cell_data, &type_option, &field_rev, vec![]); // Invalid changeset assert!(type_option.apply_changeset("123", None).is_err()); @@ -564,12 +563,12 @@ mod tests { .option(facebook_option.clone()) .option(twitter_option); - let field_meta = FieldBuilder::new(multi_select) + let field_rev = FieldBuilder::new(multi_select) .name("Platform") .visibility(true) .build(); - let type_option = MultiSelectTypeOption::from(&field_meta); + let type_option = MultiSelectTypeOption::from(&field_rev); let option_ids = vec![google_option.id.clone(), facebook_option.id.clone()].join(SELECTION_IDS_SEPARATOR); let data = SelectOptionCellContentChangeset::from_insert(&option_ids).to_str(); @@ -577,25 +576,25 @@ mod tests { assert_multi_select_options( cell_data, &type_option, - &field_meta, + &field_rev, vec![google_option.clone(), facebook_option], ); let data = SelectOptionCellContentChangeset::from_insert(&google_option.id).to_str(); let cell_data = type_option.apply_changeset(data, None).unwrap(); - assert_multi_select_options(cell_data, &type_option, &field_meta, vec![google_option]); + assert_multi_select_options(cell_data, &type_option, &field_rev, vec![google_option]); // Invalid option id let cell_data = type_option .apply_changeset(SelectOptionCellContentChangeset::from_insert("").to_str(), None) .unwrap(); - assert_multi_select_options(cell_data, &type_option, &field_meta, vec![]); + assert_multi_select_options(cell_data, &type_option, &field_rev, vec![]); // Invalid option id let cell_data = type_option .apply_changeset(SelectOptionCellContentChangeset::from_insert("123,456").to_str(), None) .unwrap(); - assert_multi_select_options(cell_data, &type_option, &field_meta, vec![]); + assert_multi_select_options(cell_data, &type_option, &field_rev, vec![]); // Invalid changeset assert!(type_option.apply_changeset("123", None).is_err()); @@ -604,13 +603,13 @@ mod tests { fn assert_multi_select_options( cell_data: String, type_option: &MultiSelectTypeOption, - field_meta: &FieldMeta, + field_rev: &FieldRevision, expected: Vec, ) { assert_eq!( expected, type_option - .decode_cell_data(cell_data, &field_meta.field_type, field_meta) + .decode_cell_data(cell_data, &field_rev.field_type, field_rev) .unwrap() .parse::() .unwrap() @@ -621,13 +620,13 @@ mod tests { fn assert_single_select_options( cell_data: String, type_option: &SingleSelectTypeOption, - field_meta: &FieldMeta, + field_rev: &FieldRevision, expected: Vec, ) { assert_eq!( expected, type_option - .decode_cell_data(cell_data, &field_meta.field_type, field_meta) + .decode_cell_data(cell_data, &field_rev.field_type, field_rev) .unwrap() .parse::() .unwrap() diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs index b59681a2ea..ef353f5035 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs @@ -4,9 +4,8 @@ use crate::services::row::{decode_cell_data, CellContentChangeset, CellDataOpera use bytes::Bytes; use flowy_derive::ProtoBuf; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{ - CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry, -}; +use flowy_grid_data_model::entities::FieldType; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision, TypeOptionDataDeserializer, TypeOptionDataEntry}; use serde::{Deserialize, Serialize}; #[derive(Default)] @@ -36,7 +35,7 @@ impl CellDataOperation for RichTextTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into, @@ -46,14 +45,14 @@ impl CellDataOperation for RichTextTypeOption { || decoded_field_type.is_multi_select() || decoded_field_type.is_number() { - decode_cell_data(encoded_data, decoded_field_type, decoded_field_type, field_meta) + decode_cell_data(encoded_data, decoded_field_type, decoded_field_type, field_rev) } else { let cell_data = encoded_data.into(); Ok(DecodedCellData::new(cell_data)) } } - fn apply_changeset(&self, changeset: C, _cell_meta: Option) -> Result + fn apply_changeset(&self, changeset: C, _cell_rev: Option) -> Result where C: Into, { @@ -79,11 +78,11 @@ mod tests { // date let field_type = FieldType::DateTime; - let date_time_field_meta = FieldBuilder::from_field_type(&field_type).build(); + let date_time_field_rev = FieldBuilder::from_field_type(&field_type).build(); assert_eq!( type_option - .decode_cell_data(1647251762.to_string(), &field_type, &date_time_field_meta) + .decode_cell_data(1647251762.to_string(), &field_type, &date_time_field_rev) .unwrap() .parse::() .unwrap() @@ -95,11 +94,11 @@ mod tests { let done_option = SelectOption::new("Done"); let done_option_id = done_option.id.clone(); let single_select = SingleSelectTypeOptionBuilder::default().option(done_option.clone()); - let single_select_field_meta = FieldBuilder::new(single_select).build(); + let single_select_field_rev = FieldBuilder::new(single_select).build(); assert_eq!( type_option - .decode_cell_data(done_option_id, &FieldType::SingleSelect, &single_select_field_meta) + .decode_cell_data(done_option_id, &FieldType::SingleSelect, &single_select_field_rev) .unwrap() .parse::() .unwrap() @@ -115,12 +114,12 @@ mod tests { let multi_select = MultiSelectTypeOptionBuilder::default() .option(google_option.clone()) .option(facebook_option.clone()); - let multi_select_field_meta = FieldBuilder::new(multi_select).build(); - let multi_type_option = MultiSelectTypeOption::from(&multi_select_field_meta); + let multi_select_field_rev = FieldBuilder::new(multi_select).build(); + let multi_type_option = MultiSelectTypeOption::from(&multi_select_field_rev); let cell_data = multi_type_option.apply_changeset(cell_data_changeset, None).unwrap(); assert_eq!( type_option - .decode_cell_data(cell_data, &FieldType::MultiSelect, &multi_select_field_meta) + .decode_cell_data(cell_data, &FieldType::MultiSelect, &multi_select_field_rev) .unwrap() .parse::() .unwrap() @@ -130,10 +129,10 @@ mod tests { //Number let number = NumberTypeOptionBuilder::default().set_format(NumberFormat::USD); - let number_field_meta = FieldBuilder::new(number).build(); + let number_field_rev = FieldBuilder::new(number).build(); assert_eq!( type_option - .decode_cell_data("18443".to_owned(), &FieldType::Number, &number_field_meta) + .decode_cell_data("18443".to_owned(), &FieldType::Number, &number_field_rev) .unwrap() .to_string(), "$18,443".to_owned() diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs index ecb2a8e16f..f5db6dcffb 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs @@ -5,9 +5,8 @@ use bytes::Bytes; use fancy_regex::Regex; use flowy_derive::ProtoBuf; use flowy_error::{internal_error, FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{ - CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry, -}; +use flowy_grid_data_model::entities::FieldType; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision, TypeOptionDataDeserializer, TypeOptionDataEntry}; use lazy_static::lazy_static; use serde::{Deserialize, Serialize}; use std::str::FromStr; @@ -39,7 +38,7 @@ impl CellDataOperation> for URLTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - _field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into>, @@ -51,7 +50,7 @@ impl CellDataOperation> for URLTypeOption { DecodedCellData::try_from_bytes(cell_data) } - fn apply_changeset(&self, changeset: C, _cell_meta: Option) -> Result + fn apply_changeset(&self, changeset: C, _cell_rev: Option) -> Result where C: Into, { @@ -126,26 +125,27 @@ mod tests { use crate::services::field::FieldBuilder; use crate::services::field::{URLCellData, URLTypeOption}; use crate::services::row::{CellDataOperation, EncodedCellData}; - use flowy_grid_data_model::entities::{FieldMeta, FieldType}; + use flowy_grid_data_model::entities::FieldType; + use flowy_grid_data_model::revision::FieldRevision; #[test] fn url_type_option_test_no_url() { let type_option = URLTypeOption::default(); let field_type = FieldType::URL; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); - assert_changeset(&type_option, "123", &field_type, &field_meta, "123", ""); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); + assert_changeset(&type_option, "123", &field_type, &field_rev, "123", ""); } #[test] fn url_type_option_test_contains_url() { let type_option = URLTypeOption::default(); let field_type = FieldType::URL; - let field_meta = FieldBuilder::from_field_type(&field_type).build(); + let field_rev = FieldBuilder::from_field_type(&field_type).build(); assert_changeset( &type_option, "AppFlowy website - https://www.appflowy.io", &field_type, - &field_meta, + &field_rev, "AppFlowy website - https://www.appflowy.io", "https://www.appflowy.io/", ); @@ -154,7 +154,7 @@ mod tests { &type_option, "AppFlowy website appflowy.io", &field_type, - &field_meta, + &field_rev, "AppFlowy website appflowy.io", "https://appflowy.io", ); @@ -164,12 +164,12 @@ mod tests { type_option: &URLTypeOption, cell_data: &str, field_type: &FieldType, - field_meta: &FieldMeta, + field_rev: &FieldRevision, expected: &str, expected_url: &str, ) { let encoded_data = type_option.apply_changeset(cell_data, None).unwrap(); - let decode_cell_data = decode_cell_data(encoded_data, type_option, field_meta, field_type); + let decode_cell_data = decode_cell_data(encoded_data, type_option, field_rev, field_type); assert_eq!(expected.to_owned(), decode_cell_data.content); assert_eq!(expected_url.to_owned(), decode_cell_data.url); } @@ -177,11 +177,11 @@ mod tests { fn decode_cell_data>>( encoded_data: T, type_option: &URLTypeOption, - field_meta: &FieldMeta, + field_rev: &FieldRevision, field_type: &FieldType, ) -> URLCellData { type_option - .decode_cell_data(encoded_data, field_type, field_meta) + .decode_cell_data(encoded_data, field_type, field_rev) .unwrap() .parse::() .unwrap() diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/util.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/util.rs index be141a41bf..70cfd2db00 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/util.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/util.rs @@ -1,9 +1,9 @@ use crate::services::row::TypeOptionCellData; -use flowy_grid_data_model::entities::CellMeta; +use flowy_grid_data_model::revision::CellRevision; use std::str::FromStr; -pub fn get_cell_data(cell_meta: &CellMeta) -> String { - match TypeOptionCellData::from_str(&cell_meta.data) { +pub fn get_cell_data(cell_rev: &CellRevision) -> String { + match TypeOptionCellData::from_str(&cell_rev.data) { Ok(type_option) => type_option.data, Err(_) => String::new(), } diff --git a/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs b/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs index 82db6aac1b..88960b0202 100644 --- a/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs +++ b/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs @@ -1,15 +1,16 @@ use crate::dart_notification::{send_dart_notification, GridNotification}; use crate::entities::CellIdentifier; use crate::manager::GridUser; -use crate::services::block_meta_manager::GridBlockManager; +use crate::services::block_manager::GridBlockManager; use crate::services::field::{default_type_option_builder_from_type, type_option_builder_from_bytes, FieldBuilder}; use crate::services::persistence::block_index::BlockIndexCache; use crate::services::row::*; use bytes::Bytes; use flowy_error::{ErrorCode, FlowyError, FlowyResult}; use flowy_grid_data_model::entities::*; +use flowy_grid_data_model::revision::*; use flowy_revision::{RevisionCloudService, RevisionCompactor, RevisionManager, RevisionObjectBuilder}; -use flowy_sync::client_grid::{GridChangeset, GridMetaPad, JsonDeserializer}; +use flowy_sync::client_grid::{GridChangeset, GridRevisionPad, JsonDeserializer}; use flowy_sync::entities::revision::Revision; use flowy_sync::errors::CollaborateResult; use flowy_sync::util::make_delta_from_revisions; @@ -22,7 +23,7 @@ use tokio::sync::RwLock; pub struct GridMetaEditor { grid_id: String, user: Arc, - grid_pad: Arc>, + grid_pad: Arc>, rev_manager: Arc, block_manager: Arc, } @@ -80,7 +81,7 @@ impl GridMetaEditor { width: Some(field.width), type_option_data: Some(type_option_data), }; - Ok(grid.update_field_meta(changeset, deserializer)?) + Ok(grid.update_field_rev(changeset, deserializer)?) }) .await?; let _ = self.notify_did_update_grid_field(&field_id).await?; @@ -88,9 +89,9 @@ impl GridMetaEditor { let _ = self .modify(|grid| { let builder = type_option_builder_from_bytes(type_option_data, &field.field_type); - let field_meta = FieldBuilder::from_field(field, builder).build(); + let field_rev = FieldBuilder::from_field(field, builder).build(); - Ok(grid.create_field_meta(field_meta, start_field_id)?) + Ok(grid.create_field_rev(field_rev, start_field_id)?) }) .await?; let _ = self.notify_did_insert_grid_field(&field_id).await?; @@ -105,42 +106,42 @@ impl GridMetaEditor { field_id: &str, type_option_data: Vec, ) -> FlowyResult<()> { - let result = self.get_field_meta(field_id).await; + let result = self.get_field_rev(field_id).await; if result.is_none() { tracing::warn!("Can't find the field with id: {}", field_id); return Ok(()); } - let field_meta = result.unwrap(); + let field_rev = result.unwrap(); let _ = self .modify(|grid| { - let deserializer = TypeOptionJsonDeserializer(field_meta.field_type.clone()); + let deserializer = TypeOptionJsonDeserializer(field_rev.field_type.clone()); let changeset = FieldChangesetParams { field_id: field_id.to_owned(), grid_id: grid_id.to_owned(), type_option_data: Some(type_option_data), ..Default::default() }; - Ok(grid.update_field_meta(changeset, deserializer)?) + Ok(grid.update_field_rev(changeset, deserializer)?) }) .await?; let _ = self.notify_did_update_grid_field(field_id).await?; Ok(()) } - pub async fn next_field_meta(&self, field_type: &FieldType) -> FlowyResult { + pub async fn next_field_rev(&self, field_type: &FieldType) -> FlowyResult { let name = format!("Property {}", self.grid_pad.read().await.fields().len() + 1); - let field_meta = FieldBuilder::from_field_type(field_type).name(&name).build(); - Ok(field_meta) + let field_rev = FieldBuilder::from_field_type(field_type).name(&name).build(); + Ok(field_rev) } - pub async fn create_next_field_meta(&self, field_type: &FieldType) -> FlowyResult { - let field_meta = self.next_field_meta(field_type).await?; + pub async fn create_next_field_rev(&self, field_type: &FieldType) -> FlowyResult { + let field_rev = self.next_field_rev(field_type).await?; let _ = self - .modify(|grid| Ok(grid.create_field_meta(field_meta.clone(), None)?)) + .modify(|grid| Ok(grid.create_field_rev(field_rev.clone(), None)?)) .await?; - let _ = self.notify_did_insert_grid_field(&field_meta.id).await?; + let _ = self.notify_did_insert_grid_field(&field_rev.id).await?; - Ok(field_meta) + Ok(field_rev) } pub async fn contain_field(&self, field_id: &str) -> bool { @@ -149,28 +150,28 @@ impl GridMetaEditor { pub async fn update_field(&self, params: FieldChangesetParams) -> FlowyResult<()> { let field_id = params.field_id.clone(); - let json_deserializer = match self.grid_pad.read().await.get_field_meta(params.field_id.as_str()) { + let json_deserializer = match self.grid_pad.read().await.get_field_rev(params.field_id.as_str()) { None => return Err(ErrorCode::FieldDoesNotExist.into()), - Some((_, field_meta)) => TypeOptionJsonDeserializer(field_meta.field_type.clone()), + Some((_, field_rev)) => TypeOptionJsonDeserializer(field_rev.field_type.clone()), }; let _ = self - .modify(|grid| Ok(grid.update_field_meta(params, json_deserializer)?)) + .modify(|grid| Ok(grid.update_field_rev(params, json_deserializer)?)) .await?; let _ = self.notify_did_update_grid_field(&field_id).await?; Ok(()) } - pub async fn replace_field(&self, field_meta: FieldMeta) -> FlowyResult<()> { - let field_id = field_meta.id.clone(); - let _ = self.modify(|pad| Ok(pad.replace_field_meta(field_meta)?)).await?; + pub async fn replace_field(&self, field_rev: FieldRevision) -> FlowyResult<()> { + let field_id = field_rev.id.clone(); + let _ = self.modify(|pad| Ok(pad.replace_field_rev(field_rev)?)).await?; let _ = self.notify_did_update_grid_field(&field_id).await?; Ok(()) } pub async fn delete_field(&self, field_id: &str) -> FlowyResult<()> { - let _ = self.modify(|grid| Ok(grid.delete_field_meta(field_id)?)).await?; + let _ = self.modify(|grid| Ok(grid.delete_field_rev(field_id)?)).await?; let field_order = FieldOrder::from(field_id); let notified_changeset = GridFieldChangeset::delete(&self.grid_id, vec![field_order]); let _ = self.notify_did_update_grid(notified_changeset).await?; @@ -184,9 +185,9 @@ impl GridMetaEditor { // .into_iter() // .map(|block_meta| block_meta.block_id) // .collect(); - // let cell_metas = self + // let cell_revs = self // .block_meta_manager - // .get_cell_metas(block_ids, field_id, None) + // .get_cell_revs(block_ids, field_id, None) // .await?; let type_option_json_builder = |field_type: &FieldType| -> String { @@ -205,80 +206,80 @@ impl GridMetaEditor { pub async fn duplicate_field(&self, field_id: &str) -> FlowyResult<()> { let duplicated_field_id = gen_field_id(); let _ = self - .modify(|grid| Ok(grid.duplicate_field_meta(field_id, &duplicated_field_id)?)) + .modify(|grid| Ok(grid.duplicate_field_rev(field_id, &duplicated_field_id)?)) .await?; let _ = self.notify_did_insert_grid_field(&duplicated_field_id).await?; Ok(()) } - pub async fn get_field_meta(&self, field_id: &str) -> Option { - let field_meta = self.grid_pad.read().await.get_field_meta(field_id)?.1.clone(); - Some(field_meta) + pub async fn get_field_rev(&self, field_id: &str) -> Option { + let field_rev = self.grid_pad.read().await.get_field_rev(field_id)?.1.clone(); + Some(field_rev) } - pub async fn get_field_metas(&self, field_ids: Option>) -> FlowyResult> + pub async fn get_field_revs(&self, field_ids: Option>) -> FlowyResult> where T: Into, { if field_ids.is_none() { - let field_metas = self.grid_pad.read().await.get_field_metas(None)?; - return Ok(field_metas); + let field_revs = self.grid_pad.read().await.get_field_revs(None)?; + return Ok(field_revs); } let to_field_orders = |item: Vec| item.into_iter().map(|data| data.into()).collect(); let field_orders = field_ids.map_or(vec![], to_field_orders); let expected_len = field_orders.len(); - let field_metas = self.grid_pad.read().await.get_field_metas(Some(field_orders))?; - if expected_len != 0 && field_metas.len() != expected_len { + let field_revs = self.grid_pad.read().await.get_field_revs(Some(field_orders))?; + if expected_len != 0 && field_revs.len() != expected_len { tracing::error!( - "This is a bug. The len of the field_metas should equal to {}", + "This is a bug. The len of the field_revs should equal to {}", expected_len ); - debug_assert!(field_metas.len() == expected_len); + debug_assert!(field_revs.len() == expected_len); } - Ok(field_metas) + Ok(field_revs) } - pub async fn create_block(&self, grid_block: GridBlockMeta) -> FlowyResult<()> { + pub async fn create_block(&self, grid_block: GridBlockRevision) -> FlowyResult<()> { let _ = self.modify(|grid| Ok(grid.create_block_meta(grid_block)?)).await?; Ok(()) } - pub async fn update_block(&self, changeset: GridBlockMetaChangeset) -> FlowyResult<()> { + pub async fn update_block(&self, changeset: GridBlockRevisionChangeset) -> FlowyResult<()> { let _ = self.modify(|grid| Ok(grid.update_block_meta(changeset)?)).await?; Ok(()) } pub async fn create_row(&self, start_row_id: Option) -> FlowyResult { - let field_metas = self.grid_pad.read().await.get_field_metas(None)?; + let field_revs = self.grid_pad.read().await.get_field_revs(None)?; let block_id = self.block_id().await?; // insert empty row below the row whose id is upper_row_id - let row_meta_ctx = CreateRowMetaBuilder::new(&field_metas).build(); - let row_meta = make_row_meta_from_context(&block_id, row_meta_ctx); - let row_order = RowOrder::from(&row_meta); + let row_rev_ctx = CreateRowMetaBuilder::new(&field_revs).build(); + let row_rev = make_row_rev_from_context(&block_id, row_rev_ctx); + let row_order = RowOrder::from(&row_rev); // insert the row - let row_count = self.block_manager.create_row(&block_id, row_meta, start_row_id).await?; + let row_count = self.block_manager.create_row(&block_id, row_rev, start_row_id).await?; // update block row count - let changeset = GridBlockMetaChangeset::from_row_count(&block_id, row_count); + let changeset = GridBlockRevisionChangeset::from_row_count(&block_id, row_count); let _ = self.update_block(changeset).await?; Ok(row_order) } pub async fn insert_rows(&self, contexts: Vec) -> FlowyResult> { let block_id = self.block_id().await?; - let mut rows_by_block_id: HashMap> = HashMap::new(); + let mut rows_by_block_id: HashMap> = HashMap::new(); let mut row_orders = vec![]; for ctx in contexts { - let row_meta = make_row_meta_from_context(&block_id, ctx); - row_orders.push(RowOrder::from(&row_meta)); + let row_rev = make_row_rev_from_context(&block_id, ctx); + row_orders.push(RowOrder::from(&row_rev)); rows_by_block_id .entry(block_id.clone()) .or_insert_with(Vec::new) - .push(row_meta); + .push(row_rev); } let changesets = self.block_manager.insert_row(rows_by_block_id).await?; for changeset in changesets { @@ -288,9 +289,9 @@ impl GridMetaEditor { } pub async fn update_row(&self, changeset: RowMetaChangeset) -> FlowyResult<()> { - let field_metas = self.get_field_metas::(None).await?; + let field_revs = self.get_field_revs::(None).await?; self.block_manager - .update_row(changeset, |row_meta| make_row_from_row_meta(&field_metas, row_meta)) + .update_row(changeset, |row_rev| make_row_from_row_rev(&field_revs, row_rev)) .await } @@ -303,8 +304,8 @@ impl GridMetaEditor { debug_assert_eq!(grid_block_snapshot.len(), 1); if grid_block_snapshot.len() == 1 { let snapshot = grid_block_snapshot.pop().unwrap(); - let field_metas = self.get_field_metas::(None).await?; - let rows = make_rows_from_row_metas(&field_metas, &snapshot.row_metas); + let field_revs = self.get_field_revs::(None).await?; + let rows = make_rows_from_row_revs(&field_revs, &snapshot.row_revs); Ok(rows.into()) } else { Ok(vec![].into()) @@ -312,12 +313,12 @@ impl GridMetaEditor { } pub async fn get_row(&self, row_id: &str) -> FlowyResult> { - match self.block_manager.get_row_meta(row_id).await? { + match self.block_manager.get_row_rev(row_id).await? { None => Ok(None), - Some(row_meta) => { - let field_metas = self.get_field_metas::(None).await?; - let row_metas = vec![row_meta]; - let mut rows = make_rows_from_row_metas(&field_metas, &row_metas); + Some(row_rev) => { + let field_revs = self.get_field_revs::(None).await?; + let row_revs = vec![row_rev]; + let mut rows = make_rows_from_row_revs(&field_revs, &row_revs); debug_assert!(rows.len() == 1); Ok(rows.pop()) } @@ -333,18 +334,18 @@ impl GridMetaEditor { } pub async fn get_cell(&self, params: &CellIdentifier) -> Option { - let field_meta = self.get_field_meta(¶ms.field_id).await?; - let row_meta = self.block_manager.get_row_meta(¶ms.row_id).await.ok()??; - make_cell(¶ms.field_id, &field_meta, &row_meta) + let field_rev = self.get_field_rev(¶ms.field_id).await?; + let row_rev = self.block_manager.get_row_rev(¶ms.row_id).await.ok()??; + make_cell(¶ms.field_id, &field_rev, &row_rev) } - pub async fn get_cell_meta(&self, row_id: &str, field_id: &str) -> FlowyResult> { - let row_meta = self.block_manager.get_row_meta(row_id).await?; - match row_meta { + pub async fn get_cell_rev(&self, row_id: &str, field_id: &str) -> FlowyResult> { + let row_rev = self.block_manager.get_row_rev(row_id).await?; + match row_rev { None => Ok(None), - Some(row_meta) => { - let cell_meta = row_meta.cells.get(field_id).cloned(); - Ok(cell_meta) + Some(row_rev) => { + let cell_rev = row_rev.cells.get(field_id).cloned(); + Ok(cell_rev) } } } @@ -362,22 +363,22 @@ impl GridMetaEditor { mut cell_content_changeset, } = cell_changeset; - match self.grid_pad.read().await.get_field_meta(&field_id) { + match self.grid_pad.read().await.get_field_rev(&field_id) { None => { let msg = format!("Field not found with id: {}", &field_id); Err(FlowyError::internal().context(msg)) } - Some((_, field_meta)) => { + Some((_, field_rev)) => { tracing::trace!("field changeset: id:{} / value:{:?}", &field_id, cell_content_changeset); - let cell_meta = self.get_cell_meta(&row_id, &field_id).await?; + let cell_rev = self.get_cell_rev(&row_id, &field_id).await?; // Update the changeset.data property with the return value. cell_content_changeset = Some(apply_cell_data_changeset( cell_content_changeset.unwrap(), - cell_meta, - field_meta, + cell_rev, + field_rev, )?); - let field_metas = self.get_field_metas::(None).await?; + let field_revs = self.get_field_revs::(None).await?; let cell_changeset = CellChangeset { grid_id, row_id, @@ -386,9 +387,7 @@ impl GridMetaEditor { }; let _ = self .block_manager - .update_cell(cell_changeset, |row_meta| { - make_row_from_row_meta(&field_metas, row_meta) - }) + .update_cell(cell_changeset, |row_rev| make_row_from_row_rev(&field_revs, row_rev)) .await?; Ok(()) } @@ -400,7 +399,7 @@ impl GridMetaEditor { make_grid_blocks(block_ids, block_snapshots) } - pub async fn get_block_metas(&self) -> FlowyResult> { + pub async fn get_block_metas(&self) -> FlowyResult> { let grid_blocks = self.grid_pad.read().await.get_block_metas(); Ok(grid_blocks) } @@ -463,9 +462,9 @@ impl GridMetaEditor { let _ = self .modify(|grid_pad| Ok(grid_pad.move_field(field_id, from as usize, to as usize)?)) .await?; - if let Some((index, field_meta)) = self.grid_pad.read().await.get_field_meta(field_id) { + if let Some((index, field_rev)) = self.grid_pad.read().await.get_field_rev(field_id) { let delete_field_order = FieldOrder::from(field_id); - let insert_field = IndexField::from_field_meta(field_meta, index); + let insert_field = IndexField::from_field_rev(field_rev, index); let notified_changeset = GridFieldChangeset { grid_id: self.grid_id.clone(), inserted_fields: vec![insert_field], @@ -510,7 +509,7 @@ impl GridMetaEditor { drop(grid_pad); Ok(BuildGridContext { - field_metas: duplicated_fields, + field_revs: duplicated_fields, blocks: duplicated_blocks, blocks_meta_data, }) @@ -518,7 +517,7 @@ impl GridMetaEditor { async fn modify(&self, f: F) -> FlowyResult<()> where - F: for<'a> FnOnce(&'a mut GridMetaPad) -> FlowyResult>, + F: for<'a> FnOnce(&'a mut GridRevisionPad) -> FlowyResult>, { let mut write_guard = self.grid_pad.write().await; if let Some(changeset) = f(&mut *write_guard)? { @@ -556,8 +555,8 @@ impl GridMetaEditor { #[tracing::instrument(level = "trace", skip_all, err)] async fn notify_did_insert_grid_field(&self, field_id: &str) -> FlowyResult<()> { - if let Some((index, field_meta)) = self.grid_pad.read().await.get_field_meta(field_id) { - let index_field = IndexField::from_field_meta(field_meta, index); + if let Some((index, field_rev)) = self.grid_pad.read().await.get_field_rev(field_id) { + let index_field = IndexField::from_field_rev(field_rev, index); let notified_changeset = GridFieldChangeset::insert(&self.grid_id, vec![index_field]); let _ = self.notify_did_update_grid(notified_changeset).await?; } @@ -566,14 +565,14 @@ impl GridMetaEditor { #[tracing::instrument(level = "trace", skip_all, err)] async fn notify_did_update_grid_field(&self, field_id: &str) -> FlowyResult<()> { - if let Some((_, field_meta)) = self + if let Some((_, field_rev)) = self .grid_pad .read() .await - .get_field_meta(field_id) + .get_field_rev(field_id) .map(|(index, field)| (index, field.clone())) { - let updated_field = Field::from(field_meta); + let updated_field = Field::from(field_rev); let notified_changeset = GridFieldChangeset::update(&self.grid_id, vec![updated_field.clone()]); let _ = self.notify_did_update_grid(notified_changeset).await?; @@ -602,10 +601,10 @@ impl GridMetaEditor { pub struct GridPadBuilder(); impl RevisionObjectBuilder for GridPadBuilder { - type Output = GridMetaPad; + type Output = GridRevisionPad; fn build_object(object_id: &str, revisions: Vec) -> FlowyResult { - let pad = GridMetaPad::from_revisions(object_id, revisions)?; + let pad = GridRevisionPad::from_revisions(object_id, revisions)?; Ok(pad) } } diff --git a/frontend/rust-lib/flowy-grid/src/services/mod.rs b/frontend/rust-lib/flowy-grid/src/services/mod.rs index c9a8217bd8..c627eba373 100644 --- a/frontend/rust-lib/flowy-grid/src/services/mod.rs +++ b/frontend/rust-lib/flowy-grid/src/services/mod.rs @@ -1,7 +1,7 @@ mod util; -pub mod block_meta_editor; -mod block_meta_manager; +mod block_manager; +pub mod block_revision_editor; pub mod field; pub mod grid_editor; pub mod persistence; diff --git a/frontend/rust-lib/flowy-grid/src/services/row/cell_data_operation.rs b/frontend/rust-lib/flowy-grid/src/services/row/cell_data_operation.rs index 7423bf0fcd..b1bde07d89 100644 --- a/frontend/rust-lib/flowy-grid/src/services/row/cell_data_operation.rs +++ b/frontend/rust-lib/flowy-grid/src/services/row/cell_data_operation.rs @@ -1,7 +1,8 @@ use crate::services::field::*; use bytes::Bytes; use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{CellMeta, FieldMeta, FieldType}; +use flowy_grid_data_model::entities::FieldType; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision}; use serde::{Deserialize, Serialize}; use std::fmt::Formatter; use std::str::FromStr; @@ -11,7 +12,7 @@ pub trait CellDataOperation { &self, encoded_data: T, decoded_field_type: &FieldType, - field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult where T: Into; @@ -20,7 +21,7 @@ pub trait CellDataOperation { fn apply_changeset>( &self, changeset: C, - cell_meta: Option, + cell_rev: Option, ) -> FlowyResult; } @@ -122,30 +123,30 @@ impl TypeOptionCellData { /// For example, it's String on FieldType::RichText, and SelectOptionChangeset on FieldType::SingleSelect pub fn apply_cell_data_changeset>( changeset: T, - cell_meta: Option, - field_meta: &FieldMeta, + cell_rev: Option, + field_rev: &FieldRevision, ) -> Result { - let s = match field_meta.field_type { - FieldType::RichText => RichTextTypeOption::from(field_meta).apply_changeset(changeset, cell_meta), - FieldType::Number => NumberTypeOption::from(field_meta).apply_changeset(changeset, cell_meta), - FieldType::DateTime => DateTypeOption::from(field_meta).apply_changeset(changeset, cell_meta), - FieldType::SingleSelect => SingleSelectTypeOption::from(field_meta).apply_changeset(changeset, cell_meta), - FieldType::MultiSelect => MultiSelectTypeOption::from(field_meta).apply_changeset(changeset, cell_meta), - FieldType::Checkbox => CheckboxTypeOption::from(field_meta).apply_changeset(changeset, cell_meta), - FieldType::URL => URLTypeOption::from(field_meta).apply_changeset(changeset, cell_meta), + let s = match field_rev.field_type { + FieldType::RichText => RichTextTypeOption::from(field_rev).apply_changeset(changeset, cell_rev), + FieldType::Number => NumberTypeOption::from(field_rev).apply_changeset(changeset, cell_rev), + FieldType::DateTime => DateTypeOption::from(field_rev).apply_changeset(changeset, cell_rev), + FieldType::SingleSelect => SingleSelectTypeOption::from(field_rev).apply_changeset(changeset, cell_rev), + FieldType::MultiSelect => MultiSelectTypeOption::from(field_rev).apply_changeset(changeset, cell_rev), + FieldType::Checkbox => CheckboxTypeOption::from(field_rev).apply_changeset(changeset, cell_rev), + FieldType::URL => URLTypeOption::from(field_rev).apply_changeset(changeset, cell_rev), }?; - Ok(TypeOptionCellData::new(s, field_meta.field_type.clone()).json()) + Ok(TypeOptionCellData::new(s, field_rev.field_type.clone()).json()) } pub fn decode_cell_data_from_type_option_cell_data>( data: T, - field_meta: &FieldMeta, + field_rev: &FieldRevision, field_type: &FieldType, ) -> DecodedCellData { if let Ok(type_option_cell_data) = data.try_into() { let (encoded_data, s_field_type) = type_option_cell_data.split(); - match decode_cell_data(encoded_data, &s_field_type, field_type, field_meta) { + match decode_cell_data(encoded_data, &s_field_type, field_type, field_rev) { Ok(cell_data) => cell_data, Err(e) => { tracing::error!("Decode cell data failed, {:?}", e); @@ -162,32 +163,32 @@ pub fn decode_cell_data>( encoded_data: T, s_field_type: &FieldType, t_field_type: &FieldType, - field_meta: &FieldMeta, + field_rev: &FieldRevision, ) -> FlowyResult { let encoded_data = encoded_data.into(); let get_cell_data = || { let data = match t_field_type { - FieldType::RichText => field_meta + FieldType::RichText => field_rev .get_type_option_entry::(t_field_type)? - .decode_cell_data(encoded_data, s_field_type, field_meta), - FieldType::Number => field_meta + .decode_cell_data(encoded_data, s_field_type, field_rev), + FieldType::Number => field_rev .get_type_option_entry::(t_field_type)? - .decode_cell_data(encoded_data, s_field_type, field_meta), - FieldType::DateTime => field_meta + .decode_cell_data(encoded_data, s_field_type, field_rev), + FieldType::DateTime => field_rev .get_type_option_entry::(t_field_type)? - .decode_cell_data(encoded_data, s_field_type, field_meta), - FieldType::SingleSelect => field_meta + .decode_cell_data(encoded_data, s_field_type, field_rev), + FieldType::SingleSelect => field_rev .get_type_option_entry::(t_field_type)? - .decode_cell_data(encoded_data, s_field_type, field_meta), - FieldType::MultiSelect => field_meta + .decode_cell_data(encoded_data, s_field_type, field_rev), + FieldType::MultiSelect => field_rev .get_type_option_entry::(t_field_type)? - .decode_cell_data(encoded_data, s_field_type, field_meta), - FieldType::Checkbox => field_meta + .decode_cell_data(encoded_data, s_field_type, field_rev), + FieldType::Checkbox => field_rev .get_type_option_entry::(t_field_type)? - .decode_cell_data(encoded_data, s_field_type, field_meta), - FieldType::URL => field_meta + .decode_cell_data(encoded_data, s_field_type, field_rev), + FieldType::URL => field_rev .get_type_option_entry::(t_field_type)? - .decode_cell_data(encoded_data, s_field_type, field_meta), + .decode_cell_data(encoded_data, s_field_type, field_rev), }; Some(data) }; diff --git a/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs b/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs index a354232a95..5b2aaf9560 100644 --- a/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs +++ b/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs @@ -1,21 +1,21 @@ use crate::services::field::SelectOptionCellContentChangeset; use crate::services::row::apply_cell_data_changeset; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{gen_row_id, CellMeta, FieldMeta, RowMeta, DEFAULT_ROW_HEIGHT}; +use flowy_grid_data_model::revision::{gen_row_id, CellRevision, FieldRevision, RowRevision, DEFAULT_ROW_HEIGHT}; use indexmap::IndexMap; use std::collections::HashMap; pub struct CreateRowMetaBuilder<'a> { - field_meta_map: HashMap<&'a String, &'a FieldMeta>, + field_rev_map: HashMap<&'a String, &'a FieldRevision>, payload: CreateRowMetaPayload, } impl<'a> CreateRowMetaBuilder<'a> { - pub fn new(fields: &'a [FieldMeta]) -> Self { - let field_meta_map = fields + pub fn new(fields: &'a [FieldRevision]) -> Self { + let field_rev_map = fields .iter() .map(|field| (&field.id, field)) - .collect::>(); + .collect::>(); let payload = CreateRowMetaPayload { row_id: gen_row_id(), @@ -25,20 +25,20 @@ impl<'a> CreateRowMetaBuilder<'a> { }; Self { - field_meta_map, + field_rev_map: field_rev_map, payload, } } pub fn add_cell(&mut self, field_id: &str, data: String) -> FlowyResult<()> { - match self.field_meta_map.get(&field_id.to_owned()) { + match self.field_rev_map.get(&field_id.to_owned()) { None => { let msg = format!("Invalid field_id: {}", field_id); Err(FlowyError::internal().context(msg)) } - Some(field_meta) => { - let data = apply_cell_data_changeset(&data, None, field_meta)?; - let cell = CellMeta::new(data); + Some(field_rev) => { + let data = apply_cell_data_changeset(&data, None, field_rev)?; + let cell = CellRevision::new(data); self.payload.cell_by_field_id.insert(field_id.to_owned(), cell); Ok(()) } @@ -46,15 +46,15 @@ impl<'a> CreateRowMetaBuilder<'a> { } pub fn add_select_option_cell(&mut self, field_id: &str, data: String) -> FlowyResult<()> { - match self.field_meta_map.get(&field_id.to_owned()) { + match self.field_rev_map.get(&field_id.to_owned()) { None => { let msg = format!("Invalid field_id: {}", field_id); Err(FlowyError::internal().context(msg)) } - Some(field_meta) => { + Some(field_rev) => { let cell_data = SelectOptionCellContentChangeset::from_insert(&data).to_str(); - let data = apply_cell_data_changeset(&cell_data, None, field_meta)?; - let cell = CellMeta::new(data); + let data = apply_cell_data_changeset(&cell_data, None, field_rev)?; + let cell = CellRevision::new(data); self.payload.cell_by_field_id.insert(field_id.to_owned(), cell); Ok(()) } @@ -78,8 +78,8 @@ impl<'a> CreateRowMetaBuilder<'a> { } } -pub fn make_row_meta_from_context(block_id: &str, payload: CreateRowMetaPayload) -> RowMeta { - RowMeta { +pub fn make_row_rev_from_context(block_id: &str, payload: CreateRowMetaPayload) -> RowRevision { + RowRevision { id: payload.row_id, block_id: block_id.to_owned(), cells: payload.cell_by_field_id, @@ -90,7 +90,7 @@ pub fn make_row_meta_from_context(block_id: &str, payload: CreateRowMetaPayload) pub struct CreateRowMetaPayload { pub row_id: String, - pub cell_by_field_id: IndexMap, + pub cell_by_field_id: IndexMap, pub height: i32, pub visibility: bool, } diff --git a/frontend/rust-lib/flowy-grid/src/services/row/row_loader.rs b/frontend/rust-lib/flowy-grid/src/services/row/row_loader.rs index 865058ffb6..07bd3c1bf7 100644 --- a/frontend/rust-lib/flowy-grid/src/services/row/row_loader.rs +++ b/frontend/rust-lib/flowy-grid/src/services/row/row_loader.rs @@ -1,14 +1,13 @@ use crate::services::row::decode_cell_data_from_type_option_cell_data; use flowy_error::FlowyResult; -use flowy_grid_data_model::entities::{ - Cell, CellMeta, FieldMeta, GridBlock, GridBlockOrder, RepeatedGridBlock, Row, RowMeta, RowOrder, -}; +use flowy_grid_data_model::entities::{Cell, GridBlock, GridBlockOrder, RepeatedGridBlock, Row, RowOrder}; +use flowy_grid_data_model::revision::{CellRevision, FieldRevision, RowRevision}; use std::collections::HashMap; use std::sync::Arc; pub struct GridBlockSnapshot { pub(crate) block_id: String, - pub row_metas: Vec>, + pub row_revs: Vec>, } pub(crate) fn group_row_orders(row_orders: Vec) -> Vec { @@ -26,52 +25,52 @@ pub(crate) fn group_row_orders(row_orders: Vec) -> Vec #[inline(always)] pub fn make_cell_by_field_id( - field_map: &HashMap<&String, &FieldMeta>, + field_map: &HashMap<&String, &FieldRevision>, field_id: String, - cell_meta: CellMeta, + cell_rev: CellRevision, ) -> Option<(String, Cell)> { - let field_meta = field_map.get(&field_id)?; - let data = decode_cell_data_from_type_option_cell_data(cell_meta.data, field_meta, &field_meta.field_type).data; + let field_rev = field_map.get(&field_id)?; + let data = decode_cell_data_from_type_option_cell_data(cell_rev.data, field_rev, &field_rev.field_type).data; let cell = Cell::new(&field_id, data); Some((field_id, cell)) } -pub fn make_cell(field_id: &str, field_meta: &FieldMeta, row_meta: &RowMeta) -> Option { - let cell_meta = row_meta.cells.get(field_id)?.clone(); - let data = decode_cell_data_from_type_option_cell_data(cell_meta.data, field_meta, &field_meta.field_type).data; +pub fn make_cell(field_id: &str, field_rev: &FieldRevision, row_rev: &RowRevision) -> Option { + let cell_rev = row_rev.cells.get(field_id)?.clone(); + let data = decode_cell_data_from_type_option_cell_data(cell_rev.data, field_rev, &field_rev.field_type).data; Some(Cell::new(field_id, data)) } -pub(crate) fn make_row_orders_from_row_metas(row_metas: &[Arc]) -> Vec { - row_metas.iter().map(RowOrder::from).collect::>() +pub(crate) fn make_row_orders_from_row_revs(row_revs: &[Arc]) -> Vec { + row_revs.iter().map(RowOrder::from).collect::>() } -pub(crate) fn make_row_from_row_meta(fields: &[FieldMeta], row_meta: Arc) -> Option { - make_rows_from_row_metas(fields, &[row_meta]).pop() +pub(crate) fn make_row_from_row_rev(fields: &[FieldRevision], row_rev: Arc) -> Option { + make_rows_from_row_revs(fields, &[row_rev]).pop() } -pub(crate) fn make_rows_from_row_metas(fields: &[FieldMeta], row_metas: &[Arc]) -> Vec { - let field_meta_map = fields +pub(crate) fn make_rows_from_row_revs(fields: &[FieldRevision], row_revs: &[Arc]) -> Vec { + let field_rev_map = fields .iter() - .map(|field_meta| (&field_meta.id, field_meta)) - .collect::>(); + .map(|field_rev| (&field_rev.id, field_rev)) + .collect::>(); - let make_row = |row_meta: &Arc| { - let cell_by_field_id = row_meta + let make_row = |row_rev: &Arc| { + let cell_by_field_id = row_rev .cells .clone() .into_iter() - .flat_map(|(field_id, cell_meta)| make_cell_by_field_id(&field_meta_map, field_id, cell_meta)) + .flat_map(|(field_id, cell_rev)| make_cell_by_field_id(&field_rev_map, field_id, cell_rev)) .collect::>(); Row { - id: row_meta.id.clone(), + id: row_rev.id.clone(), cell_by_field_id, - height: row_meta.height, + height: row_rev.height, } }; - row_metas.iter().map(make_row).collect::>() + row_revs.iter().map(make_row).collect::>() } pub(crate) fn make_grid_blocks( @@ -82,23 +81,23 @@ pub(crate) fn make_grid_blocks( None => Ok(block_snapshots .into_iter() .map(|snapshot| { - let row_orders = make_row_orders_from_row_metas(&snapshot.row_metas); + let row_orders = make_row_orders_from_row_revs(&snapshot.row_revs); GridBlock::new(&snapshot.block_id, row_orders) }) .collect::>() .into()), Some(block_ids) => { - let block_meta_data_map: HashMap<&String, &Vec>> = block_snapshots + let block_meta_data_map: HashMap<&String, &Vec>> = block_snapshots .iter() - .map(|data| (&data.block_id, &data.row_metas)) + .map(|data| (&data.block_id, &data.row_revs)) .collect(); let mut grid_blocks = vec![]; for block_id in block_ids { match block_meta_data_map.get(&block_id) { None => {} - Some(row_metas) => { - let row_orders = make_row_orders_from_row_metas(row_metas); + Some(row_revs) => { + let row_orders = make_row_orders_from_row_revs(row_revs); grid_blocks.push(GridBlock::new(&block_id, row_orders)); } } diff --git a/frontend/rust-lib/flowy-grid/src/util.rs b/frontend/rust-lib/flowy-grid/src/util.rs index f70d685c2d..8f05b1a165 100644 --- a/frontend/rust-lib/flowy-grid/src/util.rs +++ b/frontend/rust-lib/flowy-grid/src/util.rs @@ -1,5 +1,6 @@ use crate::services::field::*; -use flowy_grid_data_model::entities::{BuildGridContext, FieldType}; +use flowy_grid_data_model::entities::FieldType; +use flowy_grid_data_model::revision::BuildGridContext; use flowy_sync::client_grid::GridBuilder; pub fn make_default_grid() -> BuildGridContext { diff --git a/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs b/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs index 7b210d4f95..f7f7cc9e94 100644 --- a/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs +++ b/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs @@ -6,15 +6,15 @@ use flowy_grid::services::field::{ SingleSelectTypeOption, SELECTION_IDS_SEPARATOR, }; use flowy_grid::services::row::{decode_cell_data_from_type_option_cell_data, CreateRowMetaBuilder}; -use flowy_grid_data_model::entities::{ - CellChangeset, FieldChangesetParams, FieldType, GridBlockMeta, GridBlockMetaChangeset, RowMetaChangeset, - TypeOptionDataEntry, +use flowy_grid_data_model::entities::{CellChangeset, FieldChangesetParams, FieldType}; +use flowy_grid_data_model::revision::{ + GridBlockRevision, GridBlockRevisionChangeset, RowMetaChangeset, TypeOptionDataEntry, }; #[tokio::test] async fn grid_create_field() { let mut test = GridEditorTest::new().await; - let (text_field_params, text_field_meta) = create_text_field(&test.grid_id); + let (text_field_params, text_field_rev) = create_text_field(&test.grid_id); let (single_select_params, single_select_field) = create_single_select_field(&test.grid_id); let scripts = vec![ CreateField { @@ -22,7 +22,7 @@ async fn grid_create_field() { }, AssertFieldEqual { field_index: test.field_count, - field_meta: text_field_meta, + field_rev: text_field_rev, }, ]; test.run_scripts(scripts).await; @@ -33,7 +33,7 @@ async fn grid_create_field() { }, AssertFieldEqual { field_index: test.field_count, - field_meta: single_select_field, + field_rev: single_select_field, }, ]; test.run_scripts(scripts).await; @@ -56,9 +56,9 @@ async fn grid_create_duplicate_field() { #[tokio::test] async fn grid_update_field_with_empty_change() { let mut test = GridEditorTest::new().await; - let (params, field_meta) = create_single_select_field(&test.grid_id); + let (params, field_rev) = create_single_select_field(&test.grid_id); let changeset = FieldChangesetParams { - field_id: field_meta.id.clone(), + field_id: field_rev.id.clone(), grid_id: test.grid_id.clone(), ..Default::default() }; @@ -68,7 +68,7 @@ async fn grid_update_field_with_empty_change() { UpdateField { changeset }, AssertFieldEqual { field_index: test.field_count, - field_meta, + field_rev, }, ]; test.run_scripts(scripts).await; @@ -102,7 +102,7 @@ async fn grid_update_field() { UpdateField { changeset }, AssertFieldEqual { field_index: test.field_count, - field_meta: cloned_field, + field_rev: cloned_field, }, ]; test.run_scripts(scripts).await; @@ -115,7 +115,7 @@ async fn grid_delete_field() { let (text_params, text_field) = create_text_field(&test.grid_id); let scripts = vec![ CreateField { params: text_params }, - DeleteField { field_meta: text_field }, + DeleteField { field_rev: text_field }, AssertFieldCount(expected_field_count), ]; test.run_scripts(scripts).await; @@ -123,7 +123,7 @@ async fn grid_delete_field() { #[tokio::test] async fn grid_create_block() { - let grid_block = GridBlockMeta::new(); + let grid_block = GridBlockRevision::new(); let scripts = vec![ AssertBlockCount(1), CreateBlock { block: grid_block }, @@ -134,9 +134,9 @@ async fn grid_create_block() { #[tokio::test] async fn grid_update_block() { - let grid_block = GridBlockMeta::new(); + let grid_block = GridBlockRevision::new(); let mut cloned_grid_block = grid_block.clone(); - let changeset = GridBlockMetaChangeset { + let changeset = GridBlockRevisionChangeset { block_id: grid_block.block_id.clone(), start_row_index: Some(2), row_count: Some(10), @@ -167,7 +167,7 @@ async fn grid_create_row() { #[tokio::test] async fn grid_create_row2() { let mut test = GridEditorTest::new().await; - let create_row_context = CreateRowMetaBuilder::new(&test.field_metas).build(); + let create_row_context = CreateRowMetaBuilder::new(&test.field_revs).build(); let scripts = vec![ AssertRowCount(3), CreateRow { @@ -181,7 +181,7 @@ async fn grid_create_row2() { #[tokio::test] async fn grid_update_row() { let mut test = GridEditorTest::new().await; - let context = CreateRowMetaBuilder::new(&test.field_metas).build(); + let context = CreateRowMetaBuilder::new(&test.field_revs).build(); let changeset = RowMetaChangeset { row_id: context.row_id.clone(), height: None, @@ -204,8 +204,8 @@ async fn grid_update_row() { #[tokio::test] async fn grid_delete_row() { let mut test = GridEditorTest::new().await; - let context_1 = CreateRowMetaBuilder::new(&test.field_metas).build(); - let context_2 = CreateRowMetaBuilder::new(&test.field_metas).build(); + let context_1 = CreateRowMetaBuilder::new(&test.field_revs).build(); + let context_2 = CreateRowMetaBuilder::new(&test.field_revs).build(); let row_ids = vec![context_1.row_id.clone(), context_2.row_id.clone()]; let scripts = vec![ AssertRowCount(3), @@ -230,8 +230,8 @@ async fn grid_delete_row() { #[tokio::test] async fn grid_row_add_cells_test() { let mut test = GridEditorTest::new().await; - let mut builder = CreateRowMetaBuilder::new(&test.field_metas); - for field in &test.field_metas { + let mut builder = CreateRowMetaBuilder::new(&test.field_revs); + for field in &test.field_revs { match field.field_type { FieldType::RichText => { builder.add_cell(&field.id, "hello world".to_owned()).unwrap(); @@ -275,10 +275,10 @@ async fn grid_row_add_cells_test() { #[tokio::test] async fn grid_row_add_date_cell_test() { let mut test = GridEditorTest::new().await; - let mut builder = CreateRowMetaBuilder::new(&test.field_metas); + let mut builder = CreateRowMetaBuilder::new(&test.field_revs); let mut date_field = None; let timestamp = 1647390674; - for field in &test.field_metas { + for field in &test.field_revs { if field.field_type == FieldType::DateTime { date_field = Some(field.clone()); NaiveDateTime::from_timestamp(123, 0); @@ -307,27 +307,27 @@ async fn grid_row_add_date_cell_test() { #[tokio::test] async fn grid_cell_update() { let mut test = GridEditorTest::new().await; - let field_metas = &test.field_metas; - let row_metas = &test.row_metas; - let grid_blocks = &test.grid_blocks; - assert_eq!(row_metas.len(), 3); + let field_revs = &test.field_revs; + let row_revs = &test.row_revs; + let grid_blocks = &test.grid_block_revs; + assert_eq!(row_revs.len(), 3); assert_eq!(grid_blocks.len(), 1); let block_id = &grid_blocks.first().unwrap().block_id; let mut scripts = vec![]; - for (index, row_meta) in row_metas.iter().enumerate() { - for field_meta in field_metas { + for (index, row_rev) in row_revs.iter().enumerate() { + for field_rev in field_revs { if index == 0 { - let data = match field_meta.field_type { + let data = match field_rev.field_type { FieldType::RichText => "".to_string(), FieldType::Number => "123".to_string(), FieldType::DateTime => make_date_cell_string("123"), FieldType::SingleSelect => { - let type_option = SingleSelectTypeOption::from(field_meta); + let type_option = SingleSelectTypeOption::from(field_rev); SelectOptionCellContentChangeset::from_insert(&type_option.options.first().unwrap().id).to_str() } FieldType::MultiSelect => { - let type_option = MultiSelectTypeOption::from(field_meta); + let type_option = MultiSelectTypeOption::from(field_rev); SelectOptionCellContentChangeset::from_insert(&type_option.options.first().unwrap().id).to_str() } FieldType::Checkbox => "1".to_string(), @@ -337,8 +337,8 @@ async fn grid_cell_update() { scripts.push(UpdateCell { changeset: CellChangeset { grid_id: block_id.to_string(), - row_id: row_meta.id.clone(), - field_id: field_meta.id.clone(), + row_id: row_rev.id.clone(), + field_id: field_rev.id.clone(), cell_content_changeset: Some(data), }, is_err: false, @@ -346,7 +346,7 @@ async fn grid_cell_update() { } if index == 1 { - let (data, is_err) = match field_meta.field_type { + let (data, is_err) = match field_rev.field_type { FieldType::RichText => ("1".to_string().repeat(10001), true), FieldType::Number => ("abc".to_string(), true), FieldType::DateTime => ("abc".to_string(), true), @@ -359,8 +359,8 @@ async fn grid_cell_update() { scripts.push(UpdateCell { changeset: CellChangeset { grid_id: block_id.to_string(), - row_id: row_meta.id.clone(), - field_id: field_meta.id.clone(), + row_id: row_rev.id.clone(), + field_id: field_rev.id.clone(), cell_content_changeset: Some(data), }, is_err, diff --git a/frontend/rust-lib/flowy-grid/tests/grid/script.rs b/frontend/rust-lib/flowy-grid/tests/grid/script.rs index 37c3b736d4..ec46976b0d 100644 --- a/frontend/rust-lib/flowy-grid/tests/grid/script.rs +++ b/frontend/rust-lib/flowy-grid/tests/grid/script.rs @@ -3,8 +3,11 @@ use flowy_grid::services::field::*; use flowy_grid::services::grid_editor::{GridMetaEditor, GridPadBuilder}; use flowy_grid::services::row::CreateRowMetaPayload; use flowy_grid_data_model::entities::{ - BuildGridContext, CellChangeset, Field, FieldChangesetParams, FieldMeta, FieldOrder, FieldType, GridBlockMeta, - GridBlockMetaChangeset, InsertFieldParams, RowMeta, RowMetaChangeset, RowOrder, TypeOptionDataEntry, + CellChangeset, Field, FieldChangesetParams, FieldOrder, FieldType, InsertFieldParams, RowOrder, +}; +use flowy_grid_data_model::revision::{ + BuildGridContext, FieldRevision, GridBlockRevision, GridBlockRevisionChangeset, RowMetaChangeset, RowRevision, + TypeOptionDataEntry, }; use flowy_revision::REVISION_WRITE_INTERVAL_IN_MILLIS; use flowy_sync::client_grid::GridBuilder; @@ -24,18 +27,18 @@ pub enum EditorScript { changeset: FieldChangesetParams, }, DeleteField { - field_meta: FieldMeta, + field_rev: FieldRevision, }, AssertFieldCount(usize), AssertFieldEqual { field_index: usize, - field_meta: FieldMeta, + field_rev: FieldRevision, }, CreateBlock { - block: GridBlockMeta, + block: GridBlockRevision, }, UpdateBlock { - changeset: GridBlockMetaChangeset, + changeset: GridBlockRevisionChangeset, }, AssertBlockCount(usize), AssertBlock { @@ -45,7 +48,7 @@ pub enum EditorScript { }, AssertBlockEqual { block_index: usize, - block: GridBlockMeta, + block: GridBlockRevision, }, CreateEmptyRow, CreateRow { @@ -73,9 +76,9 @@ pub struct GridEditorTest { pub sdk: FlowySDKTest, pub grid_id: String, pub editor: Arc, - pub field_metas: Vec, - pub grid_blocks: Vec, - pub row_metas: Vec>, + pub field_revs: Vec, + pub grid_block_revs: Vec, + pub row_revs: Vec>, pub field_count: usize, pub row_order_by_row_id: HashMap, @@ -89,18 +92,18 @@ impl GridEditorTest { let view_data: Bytes = build_context.into(); let test = ViewTest::new_grid_view(&sdk, view_data.to_vec()).await; let editor = sdk.grid_manager.open_grid(&test.view.id).await.unwrap(); - let field_metas = editor.get_field_metas::(None).await.unwrap(); + let field_revs = editor.get_field_revs::(None).await.unwrap(); let grid_blocks = editor.get_block_metas().await.unwrap(); - let row_metas = get_row_metas(&editor).await; + let row_revs = get_row_revs(&editor).await; let grid_id = test.view.id; Self { sdk, grid_id, editor, - field_metas, - grid_blocks, - row_metas, + field_revs: field_revs, + grid_block_revs: grid_blocks, + row_revs: row_revs, field_count: FieldType::COUNT, row_order_by_row_id: HashMap::default(), } @@ -125,38 +128,35 @@ impl GridEditorTest { } self.editor.insert_field(params).await.unwrap(); - self.field_metas = self.editor.get_field_metas::(None).await.unwrap(); - assert_eq!(self.field_count, self.field_metas.len()); + self.field_revs = self.editor.get_field_revs::(None).await.unwrap(); + assert_eq!(self.field_count, self.field_revs.len()); } EditorScript::UpdateField { changeset: change } => { self.editor.update_field(change).await.unwrap(); - self.field_metas = self.editor.get_field_metas::(None).await.unwrap(); + self.field_revs = self.editor.get_field_revs::(None).await.unwrap(); } - EditorScript::DeleteField { field_meta } => { - if self.editor.contain_field(&field_meta.id).await { + EditorScript::DeleteField { field_rev } => { + if self.editor.contain_field(&field_rev.id).await { self.field_count -= 1; } - self.editor.delete_field(&field_meta.id).await.unwrap(); - self.field_metas = self.editor.get_field_metas::(None).await.unwrap(); - assert_eq!(self.field_count, self.field_metas.len()); + self.editor.delete_field(&field_rev.id).await.unwrap(); + self.field_revs = self.editor.get_field_revs::(None).await.unwrap(); + assert_eq!(self.field_count, self.field_revs.len()); } EditorScript::AssertFieldCount(count) => { assert_eq!( - self.editor.get_field_metas::(None).await.unwrap().len(), + self.editor.get_field_revs::(None).await.unwrap().len(), count ); } - EditorScript::AssertFieldEqual { - field_index, - field_meta, - } => { - let field_metas = self.editor.get_field_metas::(None).await.unwrap(); - assert_eq!(field_metas[field_index].clone(), field_meta); + EditorScript::AssertFieldEqual { field_index, field_rev } => { + let field_revs = self.editor.get_field_revs::(None).await.unwrap(); + assert_eq!(field_revs[field_index].clone(), field_rev); } EditorScript::CreateBlock { block } => { self.editor.create_block(block).await.unwrap(); - self.grid_blocks = self.editor.get_block_metas().await.unwrap(); + self.grid_block_revs = self.editor.get_block_metas().await.unwrap(); } EditorScript::UpdateBlock { changeset: change } => { self.editor.update_block(change).await.unwrap(); @@ -169,8 +169,8 @@ impl GridEditorTest { row_count, start_row_index, } => { - assert_eq!(self.grid_blocks[block_index].row_count, row_count); - assert_eq!(self.grid_blocks[block_index].start_row_index, start_row_index); + assert_eq!(self.grid_block_revs[block_index].row_count, row_count); + assert_eq!(self.grid_block_revs[block_index].start_row_index, start_row_index); } EditorScript::AssertBlockEqual { block_index, block } => { let blocks = self.editor.get_block_metas().await.unwrap(); @@ -180,16 +180,16 @@ impl GridEditorTest { EditorScript::CreateEmptyRow => { let row_order = self.editor.create_row(None).await.unwrap(); self.row_order_by_row_id.insert(row_order.row_id.clone(), row_order); - self.row_metas = self.get_row_metas().await; - self.grid_blocks = self.editor.get_block_metas().await.unwrap(); + self.row_revs = self.get_row_revs().await; + self.grid_block_revs = self.editor.get_block_metas().await.unwrap(); } EditorScript::CreateRow { context } => { let row_orders = self.editor.insert_rows(vec![context]).await.unwrap(); for row_order in row_orders { self.row_order_by_row_id.insert(row_order.row_id.clone(), row_order); } - self.row_metas = self.get_row_metas().await; - self.grid_blocks = self.editor.get_block_metas().await.unwrap(); + self.row_revs = self.get_row_revs().await; + self.grid_block_revs = self.editor.get_block_metas().await.unwrap(); } EditorScript::UpdateRow { changeset: change } => self.editor.update_row(change).await.unwrap(), EditorScript::DeleteRow { row_ids } => { @@ -199,11 +199,11 @@ impl GridEditorTest { .collect::>(); self.editor.delete_rows(row_orders).await.unwrap(); - self.row_metas = self.get_row_metas().await; - self.grid_blocks = self.editor.get_block_metas().await.unwrap(); + self.row_revs = self.get_row_revs().await; + self.grid_block_revs = self.editor.get_block_metas().await.unwrap(); } EditorScript::AssertRow { changeset } => { - let row = self.row_metas.iter().find(|row| row.id == changeset.row_id).unwrap(); + let row = self.row_revs.iter().find(|row| row.id == changeset.row_id).unwrap(); if let Some(visibility) = changeset.visibility { assert_eq!(row.visibility, visibility); @@ -219,11 +219,11 @@ impl GridEditorTest { assert!(result.is_err()) } else { let _ = result.unwrap(); - self.row_metas = self.get_row_metas().await; + self.row_revs = self.get_row_revs().await; } } EditorScript::AssertRowCount(count) => { - assert_eq!(self.row_metas.len(), count); + assert_eq!(self.row_revs.len(), count); } EditorScript::AssertGridMetaPad => { sleep(Duration::from_millis(2 * REVISION_WRITE_INTERVAL_IN_MILLIS)).await; @@ -234,43 +234,37 @@ impl GridEditorTest { } } - async fn get_row_metas(&self) -> Vec> { - get_row_metas(&self.editor).await + async fn get_row_revs(&self) -> Vec> { + get_row_revs(&self.editor).await } } -async fn get_row_metas(editor: &Arc) -> Vec> { - editor - .grid_block_snapshots(None) - .await - .unwrap() - .pop() - .unwrap() - .row_metas +async fn get_row_revs(editor: &Arc) -> Vec> { + editor.grid_block_snapshots(None).await.unwrap().pop().unwrap().row_revs } -pub fn create_text_field(grid_id: &str) -> (InsertFieldParams, FieldMeta) { - let field_meta = FieldBuilder::new(RichTextTypeOptionBuilder::default()) +pub fn create_text_field(grid_id: &str) -> (InsertFieldParams, FieldRevision) { + let field_rev = FieldBuilder::new(RichTextTypeOptionBuilder::default()) .name("Name") .visibility(true) .build(); - let cloned_field_meta = field_meta.clone(); + let cloned_field_rev = field_rev.clone(); - let type_option_data = field_meta - .get_type_option_entry::(&field_meta.field_type) + let type_option_data = field_rev + .get_type_option_entry::(&field_rev.field_type) .unwrap() .protobuf_bytes() .to_vec(); let field = Field { - id: field_meta.id, - name: field_meta.name, - desc: field_meta.desc, - field_type: field_meta.field_type, - frozen: field_meta.frozen, - visibility: field_meta.visibility, - width: field_meta.width, + id: field_rev.id, + name: field_rev.name, + desc: field_rev.desc, + field_type: field_rev.field_type, + frozen: field_rev.frozen, + visibility: field_rev.visibility, + width: field_rev.width, is_primary: false, }; @@ -280,30 +274,30 @@ pub fn create_text_field(grid_id: &str) -> (InsertFieldParams, FieldMeta) { type_option_data, start_field_id: None, }; - (params, cloned_field_meta) + (params, cloned_field_rev) } -pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldMeta) { +pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldRevision) { let single_select = SingleSelectTypeOptionBuilder::default() .option(SelectOption::new("Done")) .option(SelectOption::new("Progress")); - let field_meta = FieldBuilder::new(single_select).name("Name").visibility(true).build(); - let cloned_field_meta = field_meta.clone(); - let type_option_data = field_meta - .get_type_option_entry::(&field_meta.field_type) + let field_rev = FieldBuilder::new(single_select).name("Name").visibility(true).build(); + let cloned_field_rev = field_rev.clone(); + let type_option_data = field_rev + .get_type_option_entry::(&field_rev.field_type) .unwrap() .protobuf_bytes() .to_vec(); let field = Field { - id: field_meta.id, - name: field_meta.name, - desc: field_meta.desc, - field_type: field_meta.field_type, - frozen: field_meta.frozen, - visibility: field_meta.visibility, - width: field_meta.width, + id: field_rev.id, + name: field_rev.name, + desc: field_rev.desc, + field_type: field_rev.field_type, + frozen: field_rev.frozen, + visibility: field_rev.visibility, + width: field_rev.width, is_primary: false, }; @@ -313,7 +307,7 @@ pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldMet type_option_data, start_field_id: None, }; - (params, cloned_field_meta) + (params, cloned_field_rev) } fn make_template_1_grid() -> BuildGridContext { diff --git a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs index 40f091d46b..bf1757e021 100644 --- a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs +++ b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs @@ -1,10 +1,6 @@ use bytes::Bytes; use flowy_database::ConnectionPool; -use flowy_sync::client_document::default::initial_quill_delta_string; -use flowy_sync::entities::revision::{RepeatedRevision, Revision}; -use flowy_sync::entities::ws_data::ClientRevisionWSData; -use flowy_text_block::TextBlockManager; - +use flowy_folder::entities::UpdateViewInfoParams; use flowy_folder::manager::{ViewDataProcessor, ViewDataProcessorMap}; use flowy_folder::prelude::ViewDataType; use flowy_folder::{ @@ -14,20 +10,21 @@ use flowy_folder::{ }; use flowy_grid::manager::{make_grid_view_data, GridManager}; use flowy_grid::util::make_default_grid; - +use flowy_grid_data_model::revision::BuildGridContext; use flowy_net::ClientServerConfiguration; use flowy_net::{ http_server::folder::FolderHttpCloudService, local_server::LocalServer, ws::connection::FlowyWebSocketConnect, }; use flowy_revision::{RevisionWebSocket, WSStateReceiver}; +use flowy_sync::client_document::default::initial_quill_delta_string; +use flowy_sync::entities::revision::{RepeatedRevision, Revision}; +use flowy_sync::entities::ws_data::ClientRevisionWSData; +use flowy_text_block::TextBlockManager; use flowy_user::services::UserSession; use futures_core::future::BoxFuture; use lib_infra::future::{BoxResultFuture, FutureResult}; use lib_ws::{WSChannel, WSMessageReceiver, WebSocketRawMessage}; use std::collections::HashMap; - -use flowy_folder::entities::UpdateViewInfoParams; -use flowy_grid_data_model::entities::BuildGridContext; use std::convert::TryFrom; use std::{convert::TryInto, sync::Arc}; diff --git a/shared-lib/flowy-error-code/src/protobuf/model/code.rs b/shared-lib/flowy-error-code/src/protobuf/model/code.rs index 5274a61d74..5a3d2628c9 100644 --- a/shared-lib/flowy-error-code/src/protobuf/model/code.rs +++ b/shared-lib/flowy-error-code/src/protobuf/model/code.rs @@ -68,6 +68,7 @@ pub enum ErrorCode { FieldInvalidOperation = 444, TypeOptionDataIsEmpty = 450, InvalidDateTimeFormat = 500, + UnexpectedEmptyString = 999, InvalidData = 1000, } @@ -121,6 +122,7 @@ impl ::protobuf::ProtobufEnum for ErrorCode { 444 => ::std::option::Option::Some(ErrorCode::FieldInvalidOperation), 450 => ::std::option::Option::Some(ErrorCode::TypeOptionDataIsEmpty), 500 => ::std::option::Option::Some(ErrorCode::InvalidDateTimeFormat), + 999 => ::std::option::Option::Some(ErrorCode::UnexpectedEmptyString), 1000 => ::std::option::Option::Some(ErrorCode::InvalidData), _ => ::std::option::Option::None } @@ -171,6 +173,7 @@ impl ::protobuf::ProtobufEnum for ErrorCode { ErrorCode::FieldInvalidOperation, ErrorCode::TypeOptionDataIsEmpty, ErrorCode::InvalidDateTimeFormat, + ErrorCode::UnexpectedEmptyString, ErrorCode::InvalidData, ]; values @@ -200,7 +203,7 @@ impl ::protobuf::reflect::ProtobufValue for ErrorCode { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\ncode.proto*\x81\x08\n\tErrorCode\x12\x0c\n\x08Internal\x10\0\x12\x14\ + \n\ncode.proto*\x9d\x08\n\tErrorCode\x12\x0c\n\x08Internal\x10\0\x12\x14\ \n\x10UserUnauthorized\x10\x02\x12\x12\n\x0eRecordNotFound\x10\x03\x12\ \x11\n\rUserIdIsEmpty\x10\x04\x12\x18\n\x14WorkspaceNameInvalid\x10d\x12\ \x16\n\x12WorkspaceIdInvalid\x10e\x12\x18\n\x14AppColorStyleInvalid\x10f\ @@ -224,8 +227,8 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x10\xb9\x03\x12\x1c\n\x17SelectOptionNameIsEmpty\x10\xba\x03\x12\x13\n\ \x0eFieldNotExists\x10\xbb\x03\x12\x1a\n\x15FieldInvalidOperation\x10\ \xbc\x03\x12\x1a\n\x15TypeOptionDataIsEmpty\x10\xc2\x03\x12\x1a\n\x15Inv\ - alidDateTimeFormat\x10\xf4\x03\x12\x10\n\x0bInvalidData\x10\xe8\x07b\x06\ - proto3\ + alidDateTimeFormat\x10\xf4\x03\x12\x1a\n\x15UnexpectedEmptyString\x10\ + \xe7\x07\x12\x10\n\x0bInvalidData\x10\xe8\x07b\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/shared-lib/flowy-error-code/src/protobuf/proto/code.proto b/shared-lib/flowy-error-code/src/protobuf/proto/code.proto index e49862205f..67aa0ab640 100644 --- a/shared-lib/flowy-error-code/src/protobuf/proto/code.proto +++ b/shared-lib/flowy-error-code/src/protobuf/proto/code.proto @@ -44,5 +44,6 @@ enum ErrorCode { FieldInvalidOperation = 444; TypeOptionDataIsEmpty = 450; InvalidDateTimeFormat = 500; + UnexpectedEmptyString = 999; InvalidData = 1000; } diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs b/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs index e6e022ffd2..162effd9af 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs +++ b/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs @@ -744,7 +744,7 @@ impl ::protobuf::reflect::ProtobufValue for ViewExtData { #[derive(PartialEq,Clone,Default)] pub struct ViewFilter { // message fields - pub field_id: ::std::string::String, + pub object_id: ::std::string::String, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, @@ -761,30 +761,30 @@ impl ViewFilter { ::std::default::Default::default() } - // string field_id = 1; + // string object_id = 1; - pub fn get_field_id(&self) -> &str { - &self.field_id + pub fn get_object_id(&self) -> &str { + &self.object_id } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); + pub fn clear_object_id(&mut self) { + self.object_id.clear(); } // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; + pub fn set_object_id(&mut self, v: ::std::string::String) { + self.object_id = v; } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id + pub fn mut_object_id(&mut self) -> &mut ::std::string::String { + &mut self.object_id } // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + pub fn take_object_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.object_id, ::std::string::String::new()) } } @@ -798,7 +798,7 @@ impl ::protobuf::Message for ViewFilter { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.object_id)?; }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -812,8 +812,8 @@ impl ::protobuf::Message for ViewFilter { #[allow(unused_variables)] fn compute_size(&self) -> u32 { let mut my_size = 0; - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.field_id); + if !self.object_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.object_id); } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); @@ -821,8 +821,8 @@ impl ::protobuf::Message for ViewFilter { } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.field_id.is_empty() { - os.write_string(1, &self.field_id)?; + if !self.object_id.is_empty() { + os.write_string(1, &self.object_id)?; } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) @@ -863,9 +863,9 @@ impl ::protobuf::Message for ViewFilter { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &ViewFilter| { &m.field_id }, - |m: &mut ViewFilter| { &mut m.field_id }, + "object_id", + |m: &ViewFilter| { &m.object_id }, + |m: &mut ViewFilter| { &mut m.object_id }, )); ::protobuf::reflect::MessageDescriptor::new_pb_name::( "ViewFilter", @@ -883,7 +883,7 @@ impl ::protobuf::Message for ViewFilter { impl ::protobuf::Clear for ViewFilter { fn clear(&mut self) { - self.field_id.clear(); + self.object_id.clear(); self.unknown_fields.clear(); } } @@ -903,9 +903,9 @@ impl ::protobuf::reflect::ProtobufValue for ViewFilter { #[derive(PartialEq,Clone,Default)] pub struct ViewGroup { // message fields - pub group_field_id: ::std::string::String, + pub group_object_id: ::std::string::String, // message oneof groups - pub one_of_sub_group_field_id: ::std::option::Option, + pub one_of_sub_group_object_id: ::std::option::Option, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, @@ -918,8 +918,8 @@ impl<'a> ::std::default::Default for &'a ViewGroup { } #[derive(Clone,PartialEq,Debug)] -pub enum ViewGroup_oneof_one_of_sub_group_field_id { - sub_group_field_id(::std::string::String), +pub enum ViewGroup_oneof_one_of_sub_group_object_id { + sub_group_object_id(::std::string::String), } impl ViewGroup { @@ -927,74 +927,74 @@ impl ViewGroup { ::std::default::Default::default() } - // string group_field_id = 1; + // string group_object_id = 1; - pub fn get_group_field_id(&self) -> &str { - &self.group_field_id + pub fn get_group_object_id(&self) -> &str { + &self.group_object_id } - pub fn clear_group_field_id(&mut self) { - self.group_field_id.clear(); + pub fn clear_group_object_id(&mut self) { + self.group_object_id.clear(); } // Param is passed by value, moved - pub fn set_group_field_id(&mut self, v: ::std::string::String) { - self.group_field_id = v; + pub fn set_group_object_id(&mut self, v: ::std::string::String) { + self.group_object_id = v; } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_group_field_id(&mut self) -> &mut ::std::string::String { - &mut self.group_field_id + pub fn mut_group_object_id(&mut self) -> &mut ::std::string::String { + &mut self.group_object_id } // Take field - pub fn take_group_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.group_field_id, ::std::string::String::new()) + pub fn take_group_object_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.group_object_id, ::std::string::String::new()) } - // string sub_group_field_id = 2; + // string sub_group_object_id = 2; - pub fn get_sub_group_field_id(&self) -> &str { - match self.one_of_sub_group_field_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v)) => v, + pub fn get_sub_group_object_id(&self) -> &str { + match self.one_of_sub_group_object_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref v)) => v, _ => "", } } - pub fn clear_sub_group_field_id(&mut self) { - self.one_of_sub_group_field_id = ::std::option::Option::None; + pub fn clear_sub_group_object_id(&mut self) { + self.one_of_sub_group_object_id = ::std::option::Option::None; } - pub fn has_sub_group_field_id(&self) -> bool { - match self.one_of_sub_group_field_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(..)) => true, + pub fn has_sub_group_object_id(&self) -> bool { + match self.one_of_sub_group_object_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(..)) => true, _ => false, } } // Param is passed by value, moved - pub fn set_sub_group_field_id(&mut self, v: ::std::string::String) { - self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) + pub fn set_sub_group_object_id(&mut self, v: ::std::string::String) { + self.one_of_sub_group_object_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(v)) } // Mutable pointer to the field. - pub fn mut_sub_group_field_id(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(_)) = self.one_of_sub_group_field_id { + pub fn mut_sub_group_object_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(_)) = self.one_of_sub_group_object_id { } else { - self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(::std::string::String::new())); + self.one_of_sub_group_object_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(::std::string::String::new())); } - match self.one_of_sub_group_field_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref mut v)) => v, + match self.one_of_sub_group_object_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref mut v)) => v, _ => panic!(), } } // Take field - pub fn take_sub_group_field_id(&mut self) -> ::std::string::String { - if self.has_sub_group_field_id() { - match self.one_of_sub_group_field_id.take() { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) => v, + pub fn take_sub_group_object_id(&mut self) -> ::std::string::String { + if self.has_sub_group_object_id() { + match self.one_of_sub_group_object_id.take() { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(v)) => v, _ => panic!(), } } else { @@ -1013,13 +1013,13 @@ impl ::protobuf::Message for ViewGroup { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.group_field_id)?; + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.group_object_id)?; }, 2 => { if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); } - self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(is.read_string()?)); + self.one_of_sub_group_object_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(is.read_string()?)); }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -1033,12 +1033,12 @@ impl ::protobuf::Message for ViewGroup { #[allow(unused_variables)] fn compute_size(&self) -> u32 { let mut my_size = 0; - if !self.group_field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.group_field_id); + if !self.group_object_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.group_object_id); } - if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_object_id { match v { - &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + &ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref v) => { my_size += ::protobuf::rt::string_size(2, &v); }, }; @@ -1049,12 +1049,12 @@ impl ::protobuf::Message for ViewGroup { } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.group_field_id.is_empty() { - os.write_string(1, &self.group_field_id)?; + if !self.group_object_id.is_empty() { + os.write_string(1, &self.group_object_id)?; } - if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_object_id { match v { - &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + &ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref v) => { os.write_string(2, v)?; }, }; @@ -1098,14 +1098,14 @@ impl ::protobuf::Message for ViewGroup { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "group_field_id", - |m: &ViewGroup| { &m.group_field_id }, - |m: &mut ViewGroup| { &mut m.group_field_id }, + "group_object_id", + |m: &ViewGroup| { &m.group_object_id }, + |m: &mut ViewGroup| { &mut m.group_object_id }, )); fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "sub_group_field_id", - ViewGroup::has_sub_group_field_id, - ViewGroup::get_sub_group_field_id, + "sub_group_object_id", + ViewGroup::has_sub_group_object_id, + ViewGroup::get_sub_group_object_id, )); ::protobuf::reflect::MessageDescriptor::new_pb_name::( "ViewGroup", @@ -1123,8 +1123,8 @@ impl ::protobuf::Message for ViewGroup { impl ::protobuf::Clear for ViewGroup { fn clear(&mut self) { - self.group_field_id.clear(); - self.one_of_sub_group_field_id = ::std::option::Option::None; + self.group_object_id.clear(); + self.one_of_sub_group_object_id = ::std::option::Option::None; self.unknown_fields.clear(); } } @@ -1144,7 +1144,7 @@ impl ::protobuf::reflect::ProtobufValue for ViewGroup { #[derive(PartialEq,Clone,Default)] pub struct ViewSort { // message fields - pub field_id: ::std::string::String, + pub object_id: ::std::string::String, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, @@ -1161,30 +1161,30 @@ impl ViewSort { ::std::default::Default::default() } - // string field_id = 1; + // string object_id = 1; - pub fn get_field_id(&self) -> &str { - &self.field_id + pub fn get_object_id(&self) -> &str { + &self.object_id } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); + pub fn clear_object_id(&mut self) { + self.object_id.clear(); } // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; + pub fn set_object_id(&mut self, v: ::std::string::String) { + self.object_id = v; } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id + pub fn mut_object_id(&mut self) -> &mut ::std::string::String { + &mut self.object_id } // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + pub fn take_object_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.object_id, ::std::string::String::new()) } } @@ -1198,7 +1198,7 @@ impl ::protobuf::Message for ViewSort { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.object_id)?; }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -1212,8 +1212,8 @@ impl ::protobuf::Message for ViewSort { #[allow(unused_variables)] fn compute_size(&self) -> u32 { let mut my_size = 0; - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.field_id); + if !self.object_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.object_id); } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); @@ -1221,8 +1221,8 @@ impl ::protobuf::Message for ViewSort { } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.field_id.is_empty() { - os.write_string(1, &self.field_id)?; + if !self.object_id.is_empty() { + os.write_string(1, &self.object_id)?; } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) @@ -1263,9 +1263,9 @@ impl ::protobuf::Message for ViewSort { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &ViewSort| { &m.field_id }, - |m: &mut ViewSort| { &mut m.field_id }, + "object_id", + |m: &ViewSort| { &m.object_id }, + |m: &mut ViewSort| { &mut m.object_id }, )); ::protobuf::reflect::MessageDescriptor::new_pb_name::( "ViewSort", @@ -1283,7 +1283,7 @@ impl ::protobuf::Message for ViewSort { impl ::protobuf::Clear for ViewSort { fn clear(&mut self) { - self.field_id.clear(); + self.object_id.clear(); self.unknown_fields.clear(); } } @@ -1300,6 +1300,433 @@ impl ::protobuf::reflect::ProtobufValue for ViewSort { } } +#[derive(PartialEq,Clone,Default)] +pub struct UpdateViewInfoPayload { + // message fields + pub view_id: ::std::string::String, + // message oneof groups + pub one_of_filter: ::std::option::Option, + pub one_of_group: ::std::option::Option, + pub one_of_sort: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a UpdateViewInfoPayload { + fn default() -> &'a UpdateViewInfoPayload { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum UpdateViewInfoPayload_oneof_one_of_filter { + filter(ViewFilter), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum UpdateViewInfoPayload_oneof_one_of_group { + group(ViewGroup), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum UpdateViewInfoPayload_oneof_one_of_sort { + sort(ViewSort), +} + +impl UpdateViewInfoPayload { + pub fn new() -> UpdateViewInfoPayload { + ::std::default::Default::default() + } + + // string view_id = 1; + + + pub fn get_view_id(&self) -> &str { + &self.view_id + } + pub fn clear_view_id(&mut self) { + self.view_id.clear(); + } + + // Param is passed by value, moved + pub fn set_view_id(&mut self, v: ::std::string::String) { + self.view_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_view_id(&mut self) -> &mut ::std::string::String { + &mut self.view_id + } + + // Take field + pub fn take_view_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.view_id, ::std::string::String::new()) + } + + // .ViewFilter filter = 2; + + + pub fn get_filter(&self) -> &ViewFilter { + match self.one_of_filter { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v)) => v, + _ => ::default_instance(), + } + } + pub fn clear_filter(&mut self) { + self.one_of_filter = ::std::option::Option::None; + } + + pub fn has_filter(&self) -> bool { + match self.one_of_filter { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_filter(&mut self, v: ViewFilter) { + self.one_of_filter = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(v)) + } + + // Mutable pointer to the field. + pub fn mut_filter(&mut self) -> &mut ViewFilter { + if let ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(_)) = self.one_of_filter { + } else { + self.one_of_filter = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ViewFilter::new())); + } + match self.one_of_filter { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_filter(&mut self) -> ViewFilter { + if self.has_filter() { + match self.one_of_filter.take() { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(v)) => v, + _ => panic!(), + } + } else { + ViewFilter::new() + } + } + + // .ViewGroup group = 3; + + + pub fn get_group(&self) -> &ViewGroup { + match self.one_of_group { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(ref v)) => v, + _ => ::default_instance(), + } + } + pub fn clear_group(&mut self) { + self.one_of_group = ::std::option::Option::None; + } + + pub fn has_group(&self) -> bool { + match self.one_of_group { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_group(&mut self, v: ViewGroup) { + self.one_of_group = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(v)) + } + + // Mutable pointer to the field. + pub fn mut_group(&mut self) -> &mut ViewGroup { + if let ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(_)) = self.one_of_group { + } else { + self.one_of_group = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(ViewGroup::new())); + } + match self.one_of_group { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_group(&mut self) -> ViewGroup { + if self.has_group() { + match self.one_of_group.take() { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(v)) => v, + _ => panic!(), + } + } else { + ViewGroup::new() + } + } + + // .ViewSort sort = 4; + + + pub fn get_sort(&self) -> &ViewSort { + match self.one_of_sort { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v)) => v, + _ => ::default_instance(), + } + } + pub fn clear_sort(&mut self) { + self.one_of_sort = ::std::option::Option::None; + } + + pub fn has_sort(&self) -> bool { + match self.one_of_sort { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_sort(&mut self, v: ViewSort) { + self.one_of_sort = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(v)) + } + + // Mutable pointer to the field. + pub fn mut_sort(&mut self) -> &mut ViewSort { + if let ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(_)) = self.one_of_sort { + } else { + self.one_of_sort = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ViewSort::new())); + } + match self.one_of_sort { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_sort(&mut self) -> ViewSort { + if self.has_sort() { + match self.one_of_sort.take() { + ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(v)) => v, + _ => panic!(), + } + } else { + ViewSort::new() + } + } +} + +impl ::protobuf::Message for UpdateViewInfoPayload { + fn is_initialized(&self) -> bool { + if let Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v)) = self.one_of_filter { + if !v.is_initialized() { + return false; + } + } + if let Some(UpdateViewInfoPayload_oneof_one_of_group::group(ref v)) = self.one_of_group { + if !v.is_initialized() { + return false; + } + } + if let Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v)) = self.one_of_sort { + if !v.is_initialized() { + return false; + } + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.view_id)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_filter = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(is.read_message()?)); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_group = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(is.read_message()?)); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_sort = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(is.read_message()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.view_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.view_id); + } + if let ::std::option::Option::Some(ref v) = self.one_of_filter { + match v { + &UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_group { + match v { + &UpdateViewInfoPayload_oneof_one_of_group::group(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sort { + match v { + &UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.view_id.is_empty() { + os.write_string(1, &self.view_id)?; + } + if let ::std::option::Option::Some(ref v) = self.one_of_filter { + match v { + &UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v) => { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_group { + match v { + &UpdateViewInfoPayload_oneof_one_of_group::group(ref v) => { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sort { + match v { + &UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v) => { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> UpdateViewInfoPayload { + UpdateViewInfoPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "view_id", + |m: &UpdateViewInfoPayload| { &m.view_id }, + |m: &mut UpdateViewInfoPayload| { &mut m.view_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewFilter>( + "filter", + UpdateViewInfoPayload::has_filter, + UpdateViewInfoPayload::get_filter, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewGroup>( + "group", + UpdateViewInfoPayload::has_group, + UpdateViewInfoPayload::get_group, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewSort>( + "sort", + UpdateViewInfoPayload::has_sort, + UpdateViewInfoPayload::get_sort, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "UpdateViewInfoPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static UpdateViewInfoPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(UpdateViewInfoPayload::new) + } +} + +impl ::protobuf::Clear for UpdateViewInfoPayload { + fn clear(&mut self) { + self.view_id.clear(); + self.one_of_filter = ::std::option::Option::None; + self.one_of_group = ::std::option::Option::None; + self.one_of_sort = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for UpdateViewInfoPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UpdateViewInfoPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + static file_descriptor_proto_data: &'static [u8] = b"\ \n\x0fview_info.proto\x1a\nview.proto\"\xe8\x01\n\x08ViewInfo\x12\x0e\n\ \x02id\x18\x01\x20\x01(\tR\x02id\x12\x20\n\x0cbelong_to_id\x18\x02\x20\ @@ -1310,12 +1737,17 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x01(\x0b2\x0c.ViewExtDataR\x07extData\"s\n\x0bViewExtData\x12#\n\x06fil\ ter\x18\x01\x20\x01(\x0b2\x0b.ViewFilterR\x06filter\x12\x20\n\x05group\ \x18\x02\x20\x01(\x0b2\n.ViewGroupR\x05group\x12\x1d\n\x04sort\x18\x03\ - \x20\x01(\x0b2\t.ViewSortR\x04sort\"'\n\nViewFilter\x12\x19\n\x08field_i\ - d\x18\x01\x20\x01(\tR\x07fieldId\"}\n\tViewGroup\x12$\n\x0egroup_field_i\ - d\x18\x01\x20\x01(\tR\x0cgroupFieldId\x12-\n\x12sub_group_field_id\x18\ - \x02\x20\x01(\tH\0R\x0fsubGroupFieldIdB\x1b\n\x19one_of_sub_group_field_\ - id\"%\n\x08ViewSort\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\ - b\x06proto3\ + \x20\x01(\x0b2\t.ViewSortR\x04sort\")\n\nViewFilter\x12\x1b\n\tobject_id\ + \x18\x01\x20\x01(\tR\x08objectId\"\x82\x01\n\tViewGroup\x12&\n\x0fgroup_\ + object_id\x18\x01\x20\x01(\tR\rgroupObjectId\x12/\n\x13sub_group_object_\ + id\x18\x02\x20\x01(\tH\0R\x10subGroupObjectIdB\x1c\n\x1aone_of_sub_group\ + _object_id\"'\n\x08ViewSort\x12\x1b\n\tobject_id\x18\x01\x20\x01(\tR\x08\ + objectId\"\xcc\x01\n\x15UpdateViewInfoPayload\x12\x17\n\x07view_id\x18\ + \x01\x20\x01(\tR\x06viewId\x12%\n\x06filter\x18\x02\x20\x01(\x0b2\x0b.Vi\ + ewFilterH\0R\x06filter\x12\"\n\x05group\x18\x03\x20\x01(\x0b2\n.ViewGrou\ + pH\x01R\x05group\x12\x1f\n\x04sort\x18\x04\x20\x01(\x0b2\t.ViewSortH\x02\ + R\x04sortB\x0f\n\rone_of_filterB\x0e\n\x0cone_of_groupB\r\n\x0bone_of_so\ + rtb\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto index 2f85dd1b7c..29692ba2a9 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto +++ b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto @@ -16,12 +16,18 @@ message ViewExtData { ViewSort sort = 3; } message ViewFilter { - string field_id = 1; + string object_id = 1; } message ViewGroup { - string group_field_id = 1; - oneof one_of_sub_group_field_id { string sub_group_field_id = 2; }; + string group_object_id = 1; + oneof one_of_sub_group_object_id { string sub_group_object_id = 2; }; } message ViewSort { - string field_id = 1; + string object_id = 1; +} +message UpdateViewInfoPayload { + string view_id = 1; + oneof one_of_filter { ViewFilter filter = 2; }; + oneof one_of_group { ViewGroup group = 3; }; + oneof one_of_sort { ViewSort sort = 4; }; } diff --git a/shared-lib/flowy-grid-data-model/Flowy.toml b/shared-lib/flowy-grid-data-model/Flowy.toml index dcac35f40a..56b4353888 100644 --- a/shared-lib/flowy-grid-data-model/Flowy.toml +++ b/shared-lib/flowy-grid-data-model/Flowy.toml @@ -1,3 +1,3 @@ -proto_crates = ["src/entities/grid.rs",] +proto_crates = ["src/entities/",] event_files = [] \ No newline at end of file diff --git a/shared-lib/flowy-grid-data-model/src/entities/field.rs b/shared-lib/flowy-grid-data-model/src/entities/field.rs new file mode 100644 index 0000000000..d0428212bb --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/entities/field.rs @@ -0,0 +1,525 @@ +use crate::parser::NotEmptyStr; +use crate::revision::{CellRevision, FieldRevision, RowMetaChangeset, RowRevision}; +use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; +use flowy_error_code::ErrorCode; + +use serde_repr::*; + +use strum_macros::{Display, EnumCount as EnumCountMacro, EnumIter, EnumString}; + +#[derive(Debug, Clone, Default, ProtoBuf)] +pub struct Field { + #[pb(index = 1)] + pub id: String, + + #[pb(index = 2)] + pub name: String, + + #[pb(index = 3)] + pub desc: String, + + #[pb(index = 4)] + pub field_type: FieldType, + + #[pb(index = 5)] + pub frozen: bool, + + #[pb(index = 6)] + pub visibility: bool, + + #[pb(index = 7)] + pub width: i32, + + #[pb(index = 8)] + pub is_primary: bool, +} + +#[derive(Debug, Clone, Default, ProtoBuf)] +pub struct FieldOrder { + #[pb(index = 1)] + pub field_id: String, +} + +impl std::convert::From<&str> for FieldOrder { + fn from(s: &str) -> Self { + FieldOrder { field_id: s.to_owned() } + } +} + +impl std::convert::From for FieldOrder { + fn from(s: String) -> Self { + FieldOrder { field_id: s } + } +} + +#[derive(Debug, Clone, Default, ProtoBuf)] +pub struct GridFieldChangeset { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2)] + pub inserted_fields: Vec, + + #[pb(index = 3)] + pub deleted_fields: Vec, + + #[pb(index = 4)] + pub updated_fields: Vec, +} + +impl GridFieldChangeset { + pub fn insert(grid_id: &str, inserted_fields: Vec) -> Self { + Self { + grid_id: grid_id.to_owned(), + inserted_fields, + deleted_fields: vec![], + updated_fields: vec![], + } + } + + pub fn delete(grid_id: &str, deleted_fields: Vec) -> Self { + Self { + grid_id: grid_id.to_string(), + inserted_fields: vec![], + deleted_fields, + updated_fields: vec![], + } + } + + pub fn update(grid_id: &str, updated_fields: Vec) -> Self { + Self { + grid_id: grid_id.to_string(), + inserted_fields: vec![], + deleted_fields: vec![], + updated_fields, + } + } +} + +#[derive(Debug, Clone, Default, ProtoBuf)] +pub struct IndexField { + #[pb(index = 1)] + pub field: Field, + + #[pb(index = 2)] + pub index: i32, +} + +impl IndexField { + pub fn from_field_rev(field_rev: &FieldRevision, index: usize) -> Self { + Self { + field: Field::from(field_rev.clone()), + index: index as i32, + } + } +} + +#[derive(Debug, Default, ProtoBuf)] +pub struct GetEditFieldContextPayload { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2, one_of)] + pub field_id: Option, + + #[pb(index = 3)] + pub field_type: FieldType, +} + +#[derive(Debug, Default, ProtoBuf)] +pub struct EditFieldPayload { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2)] + pub field_id: String, + + #[pb(index = 3)] + pub field_type: FieldType, + + #[pb(index = 4)] + pub create_if_not_exist: bool, +} + +pub struct EditFieldParams { + pub grid_id: String, + pub field_id: String, + pub field_type: FieldType, +} + +impl TryInto for EditFieldPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; + let field_id = NotEmptyStr::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?; + Ok(EditFieldParams { + grid_id: grid_id.0, + field_id: field_id.0, + field_type: self.field_type, + }) + } +} + +pub struct CreateFieldParams { + pub grid_id: String, + pub field_type: FieldType, +} + +impl TryInto for EditFieldPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; + + Ok(CreateFieldParams { + grid_id: grid_id.0, + field_type: self.field_type, + }) + } +} + +#[derive(Debug, Default, ProtoBuf)] +pub struct FieldTypeOptionContext { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2)] + pub grid_field: Field, + + #[pb(index = 3)] + pub type_option_data: Vec, +} + +#[derive(Debug, Default, ProtoBuf)] +pub struct FieldTypeOptionData { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2)] + pub field: Field, + + #[pb(index = 3)] + pub type_option_data: Vec, +} + +#[derive(Debug, Default, ProtoBuf)] +pub struct RepeatedField { + #[pb(index = 1)] + pub items: Vec, +} +impl std::ops::Deref for RepeatedField { + type Target = Vec; + fn deref(&self) -> &Self::Target { + &self.items + } +} + +impl std::ops::DerefMut for RepeatedField { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.items + } +} + +impl std::convert::From> for RepeatedField { + fn from(items: Vec) -> Self { + Self { items } + } +} + +#[derive(Debug, Clone, Default, ProtoBuf)] +pub struct RepeatedFieldOrder { + #[pb(index = 1)] + pub items: Vec, +} + +impl std::ops::Deref for RepeatedFieldOrder { + type Target = Vec; + fn deref(&self) -> &Self::Target { + &self.items + } +} + +impl std::convert::From> for RepeatedFieldOrder { + fn from(field_orders: Vec) -> Self { + RepeatedFieldOrder { items: field_orders } + } +} + +impl std::convert::From for RepeatedFieldOrder { + fn from(s: String) -> Self { + RepeatedFieldOrder { + items: vec![FieldOrder::from(s)], + } + } +} + +#[derive(ProtoBuf, Default)] +pub struct InsertFieldPayload { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2)] + pub field: Field, + + #[pb(index = 3)] + pub type_option_data: Vec, + + #[pb(index = 4, one_of)] + pub start_field_id: Option, +} + +#[derive(Clone)] +pub struct InsertFieldParams { + pub grid_id: String, + pub field: Field, + pub type_option_data: Vec, + pub start_field_id: Option, +} + +impl TryInto for InsertFieldPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; + let _ = NotEmptyStr::parse(self.field.id.clone()).map_err(|_| ErrorCode::FieldIdIsEmpty)?; + + let start_field_id = match self.start_field_id { + None => None, + Some(id) => Some(NotEmptyStr::parse(id).map_err(|_| ErrorCode::FieldIdIsEmpty)?.0), + }; + + Ok(InsertFieldParams { + grid_id: grid_id.0, + field: self.field, + type_option_data: self.type_option_data, + start_field_id, + }) + } +} + +#[derive(ProtoBuf, Default)] +pub struct UpdateFieldTypeOptionPayload { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2)] + pub field_id: String, + + #[pb(index = 3)] + pub type_option_data: Vec, +} + +#[derive(Clone)] +pub struct UpdateFieldTypeOptionParams { + pub grid_id: String, + pub field_id: String, + pub type_option_data: Vec, +} + +impl TryInto for UpdateFieldTypeOptionPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; + let _ = NotEmptyStr::parse(self.field_id.clone()).map_err(|_| ErrorCode::FieldIdIsEmpty)?; + + Ok(UpdateFieldTypeOptionParams { + grid_id: grid_id.0, + field_id: self.field_id, + type_option_data: self.type_option_data, + }) + } +} + +#[derive(ProtoBuf, Default)] +pub struct QueryFieldPayload { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2)] + pub field_orders: RepeatedFieldOrder, +} + +pub struct QueryFieldParams { + pub grid_id: String, + pub field_orders: RepeatedFieldOrder, +} + +impl TryInto for QueryFieldPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; + Ok(QueryFieldParams { + grid_id: grid_id.0, + field_orders: self.field_orders, + }) + } +} + +#[derive(Debug, Clone, Default, ProtoBuf)] +pub struct FieldChangesetPayload { + #[pb(index = 1)] + pub field_id: String, + + #[pb(index = 2)] + pub grid_id: String, + + #[pb(index = 3, one_of)] + pub name: Option, + + #[pb(index = 4, one_of)] + pub desc: Option, + + #[pb(index = 5, one_of)] + pub field_type: Option, + + #[pb(index = 6, one_of)] + pub frozen: Option, + + #[pb(index = 7, one_of)] + pub visibility: Option, + + #[pb(index = 8, one_of)] + pub width: Option, + + #[pb(index = 9, one_of)] + pub type_option_data: Option>, +} + +#[derive(Debug, Clone, Default)] +pub struct FieldChangesetParams { + pub field_id: String, + + pub grid_id: String, + + pub name: Option, + + pub desc: Option, + + pub field_type: Option, + + pub frozen: Option, + + pub visibility: Option, + + pub width: Option, + + pub type_option_data: Option>, +} + +impl TryInto for FieldChangesetPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; + let field_id = NotEmptyStr::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?; + + if let Some(type_option_data) = self.type_option_data.as_ref() { + if type_option_data.is_empty() { + return Err(ErrorCode::TypeOptionDataIsEmpty); + } + } + + Ok(FieldChangesetParams { + field_id: field_id.0, + grid_id: grid_id.0, + name: self.name, + desc: self.desc, + field_type: self.field_type, + frozen: self.frozen, + visibility: self.visibility, + width: self.width, + type_option_data: self.type_option_data, + }) + } +} + +#[derive( + Debug, + Clone, + PartialEq, + Eq, + ProtoBuf_Enum, + EnumCountMacro, + EnumString, + EnumIter, + Display, + Serialize_repr, + Deserialize_repr, +)] +#[repr(u8)] +pub enum FieldType { + RichText = 0, + Number = 1, + DateTime = 2, + SingleSelect = 3, + MultiSelect = 4, + Checkbox = 5, + URL = 6, +} + +impl std::default::Default for FieldType { + fn default() -> Self { + FieldType::RichText + } +} + +impl AsRef for FieldType { + fn as_ref(&self) -> &FieldType { + self + } +} + +impl From<&FieldType> for FieldType { + fn from(field_type: &FieldType) -> Self { + field_type.clone() + } +} + +impl FieldType { + pub fn type_id(&self) -> String { + let ty = self.clone() as u8; + ty.to_string() + } + + pub fn default_cell_width(&self) -> i32 { + match self { + FieldType::DateTime => 180, + _ => 150, + } + } + + pub fn is_number(&self) -> bool { + self == &FieldType::Number + } + + pub fn is_text(&self) -> bool { + self == &FieldType::RichText + } + + pub fn is_checkbox(&self) -> bool { + self == &FieldType::Checkbox + } + + pub fn is_date(&self) -> bool { + self == &FieldType::DateTime + } + + pub fn is_single_select(&self) -> bool { + self == &FieldType::SingleSelect + } + + pub fn is_multi_select(&self) -> bool { + self == &FieldType::MultiSelect + } + + pub fn is_url(&self) -> bool { + self == &FieldType::URL + } + + pub fn is_select_option(&self) -> bool { + self == &FieldType::MultiSelect || self == &FieldType::SingleSelect + } +} diff --git a/shared-lib/flowy-grid-data-model/src/entities/grid.rs b/shared-lib/flowy-grid-data-model/src/entities/grid.rs index 5889e1093b..870652b7da 100644 --- a/shared-lib/flowy-grid-data-model/src/entities/grid.rs +++ b/shared-lib/flowy-grid-data-model/src/entities/grid.rs @@ -1,12 +1,10 @@ -use crate::entities::{CellMeta, FieldMeta, RowMeta, RowMetaChangeset}; +use crate::entities::FieldOrder; use crate::parser::NotEmptyStr; +use crate::revision::{CellRevision, FieldRevision, RowMetaChangeset, RowRevision}; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use flowy_error_code::ErrorCode; -use serde_repr::*; use std::collections::HashMap; -use std::sync::Arc; -use strum_macros::{Display, EnumCount as EnumCountMacro, EnumIter, EnumString}; #[derive(Debug, Clone, Default, ProtoBuf)] pub struct Grid { @@ -20,276 +18,6 @@ pub struct Grid { pub block_orders: Vec, } -#[derive(Debug, Clone, Default, ProtoBuf)] -pub struct Field { - #[pb(index = 1)] - pub id: String, - - #[pb(index = 2)] - pub name: String, - - #[pb(index = 3)] - pub desc: String, - - #[pb(index = 4)] - pub field_type: FieldType, - - #[pb(index = 5)] - pub frozen: bool, - - #[pb(index = 6)] - pub visibility: bool, - - #[pb(index = 7)] - pub width: i32, - - #[pb(index = 8)] - pub is_primary: bool, -} - -impl std::convert::From for Field { - fn from(field_meta: FieldMeta) -> Self { - Self { - id: field_meta.id, - name: field_meta.name, - desc: field_meta.desc, - field_type: field_meta.field_type, - frozen: field_meta.frozen, - visibility: field_meta.visibility, - width: field_meta.width, - is_primary: field_meta.is_primary, - } - } -} - -#[derive(Debug, Clone, Default, ProtoBuf)] -pub struct FieldOrder { - #[pb(index = 1)] - pub field_id: String, -} - -impl std::convert::From<&FieldMeta> for FieldOrder { - fn from(field_meta: &FieldMeta) -> Self { - Self { - field_id: field_meta.id.clone(), - } - } -} - -impl std::convert::From<&str> for FieldOrder { - fn from(s: &str) -> Self { - FieldOrder { field_id: s.to_owned() } - } -} - -impl std::convert::From for FieldOrder { - fn from(s: String) -> Self { - FieldOrder { field_id: s } - } -} - -#[derive(Debug, Clone, Default, ProtoBuf)] -pub struct GridFieldChangeset { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2)] - pub inserted_fields: Vec, - - #[pb(index = 3)] - pub deleted_fields: Vec, - - #[pb(index = 4)] - pub updated_fields: Vec, -} - -impl GridFieldChangeset { - pub fn insert(grid_id: &str, inserted_fields: Vec) -> Self { - Self { - grid_id: grid_id.to_owned(), - inserted_fields, - deleted_fields: vec![], - updated_fields: vec![], - } - } - - pub fn delete(grid_id: &str, deleted_fields: Vec) -> Self { - Self { - grid_id: grid_id.to_string(), - inserted_fields: vec![], - deleted_fields, - updated_fields: vec![], - } - } - - pub fn update(grid_id: &str, updated_fields: Vec) -> Self { - Self { - grid_id: grid_id.to_string(), - inserted_fields: vec![], - deleted_fields: vec![], - updated_fields, - } - } -} - -#[derive(Debug, Clone, Default, ProtoBuf)] -pub struct IndexField { - #[pb(index = 1)] - pub field: Field, - - #[pb(index = 2)] - pub index: i32, -} - -impl IndexField { - pub fn from_field_meta(field_meta: &FieldMeta, index: usize) -> Self { - Self { - field: Field::from(field_meta.clone()), - index: index as i32, - } - } -} - -#[derive(Debug, Default, ProtoBuf)] -pub struct GetEditFieldContextPayload { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2, one_of)] - pub field_id: Option, - - #[pb(index = 3)] - pub field_type: FieldType, -} - -#[derive(Debug, Default, ProtoBuf)] -pub struct EditFieldPayload { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2)] - pub field_id: String, - - #[pb(index = 3)] - pub field_type: FieldType, - - #[pb(index = 4)] - pub create_if_not_exist: bool, -} - -pub struct EditFieldParams { - pub grid_id: String, - pub field_id: String, - pub field_type: FieldType, -} - -impl TryInto for EditFieldPayload { - type Error = ErrorCode; - - fn try_into(self) -> Result { - let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; - let field_id = NotEmptyStr::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?; - Ok(EditFieldParams { - grid_id: grid_id.0, - field_id: field_id.0, - field_type: self.field_type, - }) - } -} - -pub struct CreateFieldParams { - pub grid_id: String, - pub field_type: FieldType, -} - -impl TryInto for EditFieldPayload { - type Error = ErrorCode; - - fn try_into(self) -> Result { - let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; - - Ok(CreateFieldParams { - grid_id: grid_id.0, - field_type: self.field_type, - }) - } -} - -#[derive(Debug, Default, ProtoBuf)] -pub struct FieldTypeOptionContext { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2)] - pub grid_field: Field, - - #[pb(index = 3)] - pub type_option_data: Vec, -} - -#[derive(Debug, Default, ProtoBuf)] -pub struct FieldTypeOptionData { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2)] - pub field: Field, - - #[pb(index = 3)] - pub type_option_data: Vec, -} - -#[derive(Debug, Default, ProtoBuf)] -pub struct RepeatedField { - #[pb(index = 1)] - pub items: Vec, -} -impl std::ops::Deref for RepeatedField { - type Target = Vec; - fn deref(&self) -> &Self::Target { - &self.items - } -} - -impl std::ops::DerefMut for RepeatedField { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.items - } -} - -impl std::convert::From> for RepeatedField { - fn from(items: Vec) -> Self { - Self { items } - } -} - -#[derive(Debug, Clone, Default, ProtoBuf)] -pub struct RepeatedFieldOrder { - #[pb(index = 1)] - pub items: Vec, -} - -impl std::ops::Deref for RepeatedFieldOrder { - type Target = Vec; - fn deref(&self) -> &Self::Target { - &self.items - } -} - -impl std::convert::From> for RepeatedFieldOrder { - fn from(field_orders: Vec) -> Self { - RepeatedFieldOrder { items: field_orders } - } -} - -impl std::convert::From for RepeatedFieldOrder { - fn from(s: String) -> Self { - RepeatedFieldOrder { - items: vec![FieldOrder::from(s)], - } - } -} - #[derive(Debug, Default, Clone, ProtoBuf)] pub struct RowOrder { #[pb(index = 1)] @@ -302,26 +30,6 @@ pub struct RowOrder { pub height: i32, } -impl std::convert::From<&RowMeta> for RowOrder { - fn from(row: &RowMeta) -> Self { - Self { - row_id: row.id.clone(), - block_id: row.block_id.clone(), - height: row.height, - } - } -} - -impl std::convert::From<&Arc> for RowOrder { - fn from(row: &Arc) -> Self { - Self { - row_id: row.id.clone(), - block_id: row.block_id.clone(), - height: row.height, - } - } -} - #[derive(Debug, Default, ProtoBuf)] pub struct Row { #[pb(index = 1)] @@ -395,9 +103,9 @@ pub struct UpdatedRowOrder { } impl UpdatedRowOrder { - pub fn new(row_meta: &RowMeta, row: Row) -> Self { + pub fn new(row_rev: &RowRevision, row: Row) -> Self { Self { - row_order: RowOrder::from(row_meta), + row_order: RowOrder::from(row_rev), row, } } @@ -424,8 +132,8 @@ impl std::convert::From for IndexRowOrder { } } -impl std::convert::From<&RowMeta> for IndexRowOrder { - fn from(row: &RowMeta) -> Self { +impl std::convert::From<&RowRevision> for IndexRowOrder { + fn from(row: &RowRevision) -> Self { let row_order = RowOrder::from(row); Self::from(row_order) } @@ -591,110 +299,6 @@ impl TryInto for CreateRowPayload { } } -#[derive(ProtoBuf, Default)] -pub struct InsertFieldPayload { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2)] - pub field: Field, - - #[pb(index = 3)] - pub type_option_data: Vec, - - #[pb(index = 4, one_of)] - pub start_field_id: Option, -} - -#[derive(Clone)] -pub struct InsertFieldParams { - pub grid_id: String, - pub field: Field, - pub type_option_data: Vec, - pub start_field_id: Option, -} - -impl TryInto for InsertFieldPayload { - type Error = ErrorCode; - - fn try_into(self) -> Result { - let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; - let _ = NotEmptyStr::parse(self.field.id.clone()).map_err(|_| ErrorCode::FieldIdIsEmpty)?; - - let start_field_id = match self.start_field_id { - None => None, - Some(id) => Some(NotEmptyStr::parse(id).map_err(|_| ErrorCode::FieldIdIsEmpty)?.0), - }; - - Ok(InsertFieldParams { - grid_id: grid_id.0, - field: self.field, - type_option_data: self.type_option_data, - start_field_id, - }) - } -} - -#[derive(ProtoBuf, Default)] -pub struct UpdateFieldTypeOptionPayload { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2)] - pub field_id: String, - - #[pb(index = 3)] - pub type_option_data: Vec, -} - -#[derive(Clone)] -pub struct UpdateFieldTypeOptionParams { - pub grid_id: String, - pub field_id: String, - pub type_option_data: Vec, -} - -impl TryInto for UpdateFieldTypeOptionPayload { - type Error = ErrorCode; - - fn try_into(self) -> Result { - let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; - let _ = NotEmptyStr::parse(self.field_id.clone()).map_err(|_| ErrorCode::FieldIdIsEmpty)?; - - Ok(UpdateFieldTypeOptionParams { - grid_id: grid_id.0, - field_id: self.field_id, - type_option_data: self.type_option_data, - }) - } -} - -#[derive(ProtoBuf, Default)] -pub struct QueryFieldPayload { - #[pb(index = 1)] - pub grid_id: String, - - #[pb(index = 2)] - pub field_orders: RepeatedFieldOrder, -} - -pub struct QueryFieldParams { - pub grid_id: String, - pub field_orders: RepeatedFieldOrder, -} - -impl TryInto for QueryFieldPayload { - type Error = ErrorCode; - - fn try_into(self) -> Result { - let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; - Ok(QueryFieldParams { - grid_id: grid_id.0, - field_orders: self.field_orders, - }) - } -} - #[derive(ProtoBuf, Default)] pub struct QueryGridBlocksPayload { #[pb(index = 1)] @@ -721,84 +325,6 @@ impl TryInto for QueryGridBlocksPayload { } } -#[derive(Debug, Clone, Default, ProtoBuf)] -pub struct FieldChangesetPayload { - #[pb(index = 1)] - pub field_id: String, - - #[pb(index = 2)] - pub grid_id: String, - - #[pb(index = 3, one_of)] - pub name: Option, - - #[pb(index = 4, one_of)] - pub desc: Option, - - #[pb(index = 5, one_of)] - pub field_type: Option, - - #[pb(index = 6, one_of)] - pub frozen: Option, - - #[pb(index = 7, one_of)] - pub visibility: Option, - - #[pb(index = 8, one_of)] - pub width: Option, - - #[pb(index = 9, one_of)] - pub type_option_data: Option>, -} - -#[derive(Debug, Clone, Default)] -pub struct FieldChangesetParams { - pub field_id: String, - - pub grid_id: String, - - pub name: Option, - - pub desc: Option, - - pub field_type: Option, - - pub frozen: Option, - - pub visibility: Option, - - pub width: Option, - - pub type_option_data: Option>, -} - -impl TryInto for FieldChangesetPayload { - type Error = ErrorCode; - - fn try_into(self) -> Result { - let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?; - let field_id = NotEmptyStr::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?; - - if let Some(type_option_data) = self.type_option_data.as_ref() { - if type_option_data.is_empty() { - return Err(ErrorCode::TypeOptionDataIsEmpty); - } - } - - Ok(FieldChangesetParams { - field_id: field_id.0, - grid_id: grid_id.0, - name: self.name, - desc: self.desc, - field_type: self.field_type, - frozen: self.frozen, - visibility: self.visibility, - width: self.width, - type_option_data: self.type_option_data, - }) - } -} - #[derive(Debug, Clone, ProtoBuf_Enum)] pub enum MoveItemType { MoveField = 0, @@ -854,94 +380,6 @@ impl TryInto for MoveItemPayload { } } -#[derive( - Debug, - Clone, - PartialEq, - Eq, - ProtoBuf_Enum, - EnumCountMacro, - EnumString, - EnumIter, - Display, - Serialize_repr, - Deserialize_repr, -)] -#[repr(u8)] -pub enum FieldType { - RichText = 0, - Number = 1, - DateTime = 2, - SingleSelect = 3, - MultiSelect = 4, - Checkbox = 5, - URL = 6, -} - -impl std::default::Default for FieldType { - fn default() -> Self { - FieldType::RichText - } -} - -impl AsRef for FieldType { - fn as_ref(&self) -> &FieldType { - self - } -} - -impl From<&FieldType> for FieldType { - fn from(field_type: &FieldType) -> Self { - field_type.clone() - } -} - -impl FieldType { - pub fn type_id(&self) -> String { - let ty = self.clone(); - format!("{}", ty as u8) - } - - pub fn default_cell_width(&self) -> i32 { - match self { - FieldType::DateTime => 180, - _ => 150, - } - } - - pub fn is_number(&self) -> bool { - self == &FieldType::Number - } - - pub fn is_text(&self) -> bool { - self == &FieldType::RichText - } - - pub fn is_checkbox(&self) -> bool { - self == &FieldType::Checkbox - } - - pub fn is_date(&self) -> bool { - self == &FieldType::DateTime - } - - pub fn is_single_select(&self) -> bool { - self == &FieldType::SingleSelect - } - - pub fn is_multi_select(&self) -> bool { - self == &FieldType::MultiSelect - } - - pub fn is_url(&self) -> bool { - self == &FieldType::URL - } - - pub fn is_select_option(&self) -> bool { - self == &FieldType::MultiSelect || self == &FieldType::SingleSelect - } -} - #[derive(Debug, Clone, Default, ProtoBuf)] pub struct CellChangeset { #[pb(index = 1)] @@ -956,21 +394,3 @@ pub struct CellChangeset { #[pb(index = 4, one_of)] pub cell_content_changeset: Option, } - -impl std::convert::From for RowMetaChangeset { - fn from(changeset: CellChangeset) -> Self { - let mut cell_by_field_id = HashMap::with_capacity(1); - let field_id = changeset.field_id; - let cell_meta = CellMeta { - data: changeset.cell_content_changeset.unwrap_or_else(|| "".to_owned()), - }; - cell_by_field_id.insert(field_id, cell_meta); - - RowMetaChangeset { - row_id: changeset.row_id, - height: None, - visibility: None, - cell_by_field_id, - } - } -} diff --git a/shared-lib/flowy-grid-data-model/src/entities/mod.rs b/shared-lib/flowy-grid-data-model/src/entities/mod.rs index 350f8092d5..7e595e4f75 100644 --- a/shared-lib/flowy-grid-data-model/src/entities/mod.rs +++ b/shared-lib/flowy-grid-data-model/src/entities/mod.rs @@ -1,5 +1,5 @@ +mod field; mod grid; -mod meta; +pub use field::*; pub use grid::*; -pub use meta::*; diff --git a/shared-lib/flowy-grid-data-model/src/lib.rs b/shared-lib/flowy-grid-data-model/src/lib.rs index bd9ed4465e..0e92bcfc71 100644 --- a/shared-lib/flowy-grid-data-model/src/lib.rs +++ b/shared-lib/flowy-grid-data-model/src/lib.rs @@ -1,3 +1,4 @@ pub mod entities; pub mod parser; pub mod protobuf; +pub mod revision; diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/model/field.rs b/shared-lib/flowy-grid-data-model/src/protobuf/model/field.rs new file mode 100644 index 0000000000..405806d171 --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/protobuf/model/field.rs @@ -0,0 +1,4104 @@ +// This file is generated by rust-protobuf 2.25.2. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `field.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2; + +#[derive(PartialEq,Clone,Default)] +pub struct Field { + // message fields + pub id: ::std::string::String, + pub name: ::std::string::String, + pub desc: ::std::string::String, + pub field_type: FieldType, + pub frozen: bool, + pub visibility: bool, + pub width: i32, + pub is_primary: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Field { + fn default() -> &'a Field { + ::default_instance() + } +} + +impl Field { + pub fn new() -> Field { + ::std::default::Default::default() + } + + // string id = 1; + + + pub fn get_id(&self) -> &str { + &self.id + } + pub fn clear_id(&mut self) { + self.id.clear(); + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::string::String) { + self.id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::string::String { + &mut self.id + } + + // Take field + pub fn take_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.id, ::std::string::String::new()) + } + + // string name = 2; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // string desc = 3; + + + pub fn get_desc(&self) -> &str { + &self.desc + } + pub fn clear_desc(&mut self) { + self.desc.clear(); + } + + // Param is passed by value, moved + pub fn set_desc(&mut self, v: ::std::string::String) { + self.desc = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_desc(&mut self) -> &mut ::std::string::String { + &mut self.desc + } + + // Take field + pub fn take_desc(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.desc, ::std::string::String::new()) + } + + // .FieldType field_type = 4; + + + pub fn get_field_type(&self) -> FieldType { + self.field_type + } + pub fn clear_field_type(&mut self) { + self.field_type = FieldType::RichText; + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: FieldType) { + self.field_type = v; + } + + // bool frozen = 5; + + + pub fn get_frozen(&self) -> bool { + self.frozen + } + pub fn clear_frozen(&mut self) { + self.frozen = false; + } + + // Param is passed by value, moved + pub fn set_frozen(&mut self, v: bool) { + self.frozen = v; + } + + // bool visibility = 6; + + + pub fn get_visibility(&self) -> bool { + self.visibility + } + pub fn clear_visibility(&mut self) { + self.visibility = false; + } + + // Param is passed by value, moved + pub fn set_visibility(&mut self, v: bool) { + self.visibility = v; + } + + // int32 width = 7; + + + pub fn get_width(&self) -> i32 { + self.width + } + pub fn clear_width(&mut self) { + self.width = 0; + } + + // Param is passed by value, moved + pub fn set_width(&mut self, v: i32) { + self.width = v; + } + + // bool is_primary = 8; + + + pub fn get_is_primary(&self) -> bool { + self.is_primary + } + pub fn clear_is_primary(&mut self) { + self.is_primary = false; + } + + // Param is passed by value, moved + pub fn set_is_primary(&mut self, v: bool) { + self.is_primary = v; + } +} + +impl ::protobuf::Message for Field { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.desc)?; + }, + 4 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 4, &mut self.unknown_fields)? + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.frozen = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.visibility = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.width = tmp; + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_primary = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.id); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.name); + } + if !self.desc.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.desc); + } + if self.field_type != FieldType::RichText { + my_size += ::protobuf::rt::enum_size(4, self.field_type); + } + if self.frozen != false { + my_size += 2; + } + if self.visibility != false { + my_size += 2; + } + if self.width != 0 { + my_size += ::protobuf::rt::value_size(7, self.width, ::protobuf::wire_format::WireTypeVarint); + } + if self.is_primary != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.id.is_empty() { + os.write_string(1, &self.id)?; + } + if !self.name.is_empty() { + os.write_string(2, &self.name)?; + } + if !self.desc.is_empty() { + os.write_string(3, &self.desc)?; + } + if self.field_type != FieldType::RichText { + os.write_enum(4, ::protobuf::ProtobufEnum::value(&self.field_type))?; + } + if self.frozen != false { + os.write_bool(5, self.frozen)?; + } + if self.visibility != false { + os.write_bool(6, self.visibility)?; + } + if self.width != 0 { + os.write_int32(7, self.width)?; + } + if self.is_primary != false { + os.write_bool(8, self.is_primary)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Field { + Field::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "id", + |m: &Field| { &m.id }, + |m: &mut Field| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &Field| { &m.name }, + |m: &mut Field| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "desc", + |m: &Field| { &m.desc }, + |m: &mut Field| { &mut m.desc }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "field_type", + |m: &Field| { &m.field_type }, + |m: &mut Field| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "frozen", + |m: &Field| { &m.frozen }, + |m: &mut Field| { &mut m.frozen }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "visibility", + |m: &Field| { &m.visibility }, + |m: &mut Field| { &mut m.visibility }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "width", + |m: &Field| { &m.width }, + |m: &mut Field| { &mut m.width }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_primary", + |m: &Field| { &m.is_primary }, + |m: &mut Field| { &mut m.is_primary }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "Field", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static Field { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(Field::new) + } +} + +impl ::protobuf::Clear for Field { + fn clear(&mut self) { + self.id.clear(); + self.name.clear(); + self.desc.clear(); + self.field_type = FieldType::RichText; + self.frozen = false; + self.visibility = false; + self.width = 0; + self.is_primary = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Field { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Field { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct FieldOrder { + // message fields + pub field_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a FieldOrder { + fn default() -> &'a FieldOrder { + ::default_instance() + } +} + +impl FieldOrder { + pub fn new() -> FieldOrder { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for FieldOrder { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.field_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.field_id.is_empty() { + os.write_string(1, &self.field_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> FieldOrder { + FieldOrder::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &FieldOrder| { &m.field_id }, + |m: &mut FieldOrder| { &mut m.field_id }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "FieldOrder", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static FieldOrder { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(FieldOrder::new) + } +} + +impl ::protobuf::Clear for FieldOrder { + fn clear(&mut self) { + self.field_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for FieldOrder { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FieldOrder { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GridFieldChangeset { + // message fields + pub grid_id: ::std::string::String, + pub inserted_fields: ::protobuf::RepeatedField, + pub deleted_fields: ::protobuf::RepeatedField, + pub updated_fields: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a GridFieldChangeset { + fn default() -> &'a GridFieldChangeset { + ::default_instance() + } +} + +impl GridFieldChangeset { + pub fn new() -> GridFieldChangeset { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // repeated .IndexField inserted_fields = 2; + + + pub fn get_inserted_fields(&self) -> &[IndexField] { + &self.inserted_fields + } + pub fn clear_inserted_fields(&mut self) { + self.inserted_fields.clear(); + } + + // Param is passed by value, moved + pub fn set_inserted_fields(&mut self, v: ::protobuf::RepeatedField) { + self.inserted_fields = v; + } + + // Mutable pointer to the field. + pub fn mut_inserted_fields(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.inserted_fields + } + + // Take field + pub fn take_inserted_fields(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.inserted_fields, ::protobuf::RepeatedField::new()) + } + + // repeated .FieldOrder deleted_fields = 3; + + + pub fn get_deleted_fields(&self) -> &[FieldOrder] { + &self.deleted_fields + } + pub fn clear_deleted_fields(&mut self) { + self.deleted_fields.clear(); + } + + // Param is passed by value, moved + pub fn set_deleted_fields(&mut self, v: ::protobuf::RepeatedField) { + self.deleted_fields = v; + } + + // Mutable pointer to the field. + pub fn mut_deleted_fields(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.deleted_fields + } + + // Take field + pub fn take_deleted_fields(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.deleted_fields, ::protobuf::RepeatedField::new()) + } + + // repeated .Field updated_fields = 4; + + + pub fn get_updated_fields(&self) -> &[Field] { + &self.updated_fields + } + pub fn clear_updated_fields(&mut self) { + self.updated_fields.clear(); + } + + // Param is passed by value, moved + pub fn set_updated_fields(&mut self, v: ::protobuf::RepeatedField) { + self.updated_fields = v; + } + + // Mutable pointer to the field. + pub fn mut_updated_fields(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.updated_fields + } + + // Take field + pub fn take_updated_fields(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.updated_fields, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for GridFieldChangeset { + fn is_initialized(&self) -> bool { + for v in &self.inserted_fields { + if !v.is_initialized() { + return false; + } + }; + for v in &self.deleted_fields { + if !v.is_initialized() { + return false; + } + }; + for v in &self.updated_fields { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.inserted_fields)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.deleted_fields)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.updated_fields)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + for value in &self.inserted_fields { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.deleted_fields { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.updated_fields { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + for v in &self.inserted_fields { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.deleted_fields { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.updated_fields { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> GridFieldChangeset { + GridFieldChangeset::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &GridFieldChangeset| { &m.grid_id }, + |m: &mut GridFieldChangeset| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "inserted_fields", + |m: &GridFieldChangeset| { &m.inserted_fields }, + |m: &mut GridFieldChangeset| { &mut m.inserted_fields }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "deleted_fields", + |m: &GridFieldChangeset| { &m.deleted_fields }, + |m: &mut GridFieldChangeset| { &mut m.deleted_fields }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "updated_fields", + |m: &GridFieldChangeset| { &m.updated_fields }, + |m: &mut GridFieldChangeset| { &mut m.updated_fields }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "GridFieldChangeset", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static GridFieldChangeset { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(GridFieldChangeset::new) + } +} + +impl ::protobuf::Clear for GridFieldChangeset { + fn clear(&mut self) { + self.grid_id.clear(); + self.inserted_fields.clear(); + self.deleted_fields.clear(); + self.updated_fields.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GridFieldChangeset { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GridFieldChangeset { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct IndexField { + // message fields + pub field: ::protobuf::SingularPtrField, + pub index: i32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a IndexField { + fn default() -> &'a IndexField { + ::default_instance() + } +} + +impl IndexField { + pub fn new() -> IndexField { + ::std::default::Default::default() + } + + // .Field field = 1; + + + pub fn get_field(&self) -> &Field { + self.field.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_field(&mut self) { + self.field.clear(); + } + + pub fn has_field(&self) -> bool { + self.field.is_some() + } + + // Param is passed by value, moved + pub fn set_field(&mut self, v: Field) { + self.field = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field(&mut self) -> &mut Field { + if self.field.is_none() { + self.field.set_default(); + } + self.field.as_mut().unwrap() + } + + // Take field + pub fn take_field(&mut self) -> Field { + self.field.take().unwrap_or_else(|| Field::new()) + } + + // int32 index = 2; + + + pub fn get_index(&self) -> i32 { + self.index + } + pub fn clear_index(&mut self) { + self.index = 0; + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: i32) { + self.index = v; + } +} + +impl ::protobuf::Message for IndexField { + fn is_initialized(&self) -> bool { + for v in &self.field { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.index = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.field.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.index != 0 { + my_size += ::protobuf::rt::value_size(2, self.index, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.field.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.index != 0 { + os.write_int32(2, self.index)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> IndexField { + IndexField::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "field", + |m: &IndexField| { &m.field }, + |m: &mut IndexField| { &mut m.field }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "index", + |m: &IndexField| { &m.index }, + |m: &mut IndexField| { &mut m.index }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "IndexField", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static IndexField { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(IndexField::new) + } +} + +impl ::protobuf::Clear for IndexField { + fn clear(&mut self) { + self.field.clear(); + self.index = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for IndexField { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for IndexField { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetEditFieldContextPayload { + // message fields + pub grid_id: ::std::string::String, + pub field_type: FieldType, + // message oneof groups + pub one_of_field_id: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a GetEditFieldContextPayload { + fn default() -> &'a GetEditFieldContextPayload { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum GetEditFieldContextPayload_oneof_one_of_field_id { + field_id(::std::string::String), +} + +impl GetEditFieldContextPayload { + pub fn new() -> GetEditFieldContextPayload { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // string field_id = 2; + + + pub fn get_field_id(&self) -> &str { + match self.one_of_field_id { + ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_field_id(&mut self) { + self.one_of_field_id = ::std::option::Option::None; + } + + pub fn has_field_id(&self) -> bool { + match self.one_of_field_id { + ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.one_of_field_id = ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(_)) = self.one_of_field_id { + } else { + self.one_of_field_id = ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(::std::string::String::new())); + } + match self.one_of_field_id { + ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + if self.has_field_id() { + match self.one_of_field_id.take() { + ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } + + // .FieldType field_type = 3; + + + pub fn get_field_type(&self) -> FieldType { + self.field_type + } + pub fn clear_field_type(&mut self) { + self.field_type = FieldType::RichText; + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: FieldType) { + self.field_type = v; + } +} + +impl ::protobuf::Message for GetEditFieldContextPayload { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_field_id = ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(is.read_string()?)); + }, + 3 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 3, &mut self.unknown_fields)? + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if self.field_type != FieldType::RichText { + my_size += ::protobuf::rt::enum_size(3, self.field_type); + } + if let ::std::option::Option::Some(ref v) = self.one_of_field_id { + match v { + &GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref v) => { + my_size += ::protobuf::rt::string_size(2, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if self.field_type != FieldType::RichText { + os.write_enum(3, ::protobuf::ProtobufEnum::value(&self.field_type))?; + } + if let ::std::option::Option::Some(ref v) = self.one_of_field_id { + match v { + &GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref v) => { + os.write_string(2, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> GetEditFieldContextPayload { + GetEditFieldContextPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &GetEditFieldContextPayload| { &m.grid_id }, + |m: &mut GetEditFieldContextPayload| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "field_id", + GetEditFieldContextPayload::has_field_id, + GetEditFieldContextPayload::get_field_id, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "field_type", + |m: &GetEditFieldContextPayload| { &m.field_type }, + |m: &mut GetEditFieldContextPayload| { &mut m.field_type }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "GetEditFieldContextPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static GetEditFieldContextPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(GetEditFieldContextPayload::new) + } +} + +impl ::protobuf::Clear for GetEditFieldContextPayload { + fn clear(&mut self) { + self.grid_id.clear(); + self.one_of_field_id = ::std::option::Option::None; + self.field_type = FieldType::RichText; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetEditFieldContextPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetEditFieldContextPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct EditFieldPayload { + // message fields + pub grid_id: ::std::string::String, + pub field_id: ::std::string::String, + pub field_type: FieldType, + pub create_if_not_exist: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a EditFieldPayload { + fn default() -> &'a EditFieldPayload { + ::default_instance() + } +} + +impl EditFieldPayload { + pub fn new() -> EditFieldPayload { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // string field_id = 2; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } + + // .FieldType field_type = 3; + + + pub fn get_field_type(&self) -> FieldType { + self.field_type + } + pub fn clear_field_type(&mut self) { + self.field_type = FieldType::RichText; + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: FieldType) { + self.field_type = v; + } + + // bool create_if_not_exist = 4; + + + pub fn get_create_if_not_exist(&self) -> bool { + self.create_if_not_exist + } + pub fn clear_create_if_not_exist(&mut self) { + self.create_if_not_exist = false; + } + + // Param is passed by value, moved + pub fn set_create_if_not_exist(&mut self, v: bool) { + self.create_if_not_exist = v; + } +} + +impl ::protobuf::Message for EditFieldPayload { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + 3 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 3, &mut self.unknown_fields)? + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.create_if_not_exist = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.field_id); + } + if self.field_type != FieldType::RichText { + my_size += ::protobuf::rt::enum_size(3, self.field_type); + } + if self.create_if_not_exist != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if !self.field_id.is_empty() { + os.write_string(2, &self.field_id)?; + } + if self.field_type != FieldType::RichText { + os.write_enum(3, ::protobuf::ProtobufEnum::value(&self.field_type))?; + } + if self.create_if_not_exist != false { + os.write_bool(4, self.create_if_not_exist)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> EditFieldPayload { + EditFieldPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &EditFieldPayload| { &m.grid_id }, + |m: &mut EditFieldPayload| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &EditFieldPayload| { &m.field_id }, + |m: &mut EditFieldPayload| { &mut m.field_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "field_type", + |m: &EditFieldPayload| { &m.field_type }, + |m: &mut EditFieldPayload| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "create_if_not_exist", + |m: &EditFieldPayload| { &m.create_if_not_exist }, + |m: &mut EditFieldPayload| { &mut m.create_if_not_exist }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "EditFieldPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static EditFieldPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(EditFieldPayload::new) + } +} + +impl ::protobuf::Clear for EditFieldPayload { + fn clear(&mut self) { + self.grid_id.clear(); + self.field_id.clear(); + self.field_type = FieldType::RichText; + self.create_if_not_exist = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for EditFieldPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for EditFieldPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct FieldTypeOptionContext { + // message fields + pub grid_id: ::std::string::String, + pub grid_field: ::protobuf::SingularPtrField, + pub type_option_data: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a FieldTypeOptionContext { + fn default() -> &'a FieldTypeOptionContext { + ::default_instance() + } +} + +impl FieldTypeOptionContext { + pub fn new() -> FieldTypeOptionContext { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // .Field grid_field = 2; + + + pub fn get_grid_field(&self) -> &Field { + self.grid_field.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_grid_field(&mut self) { + self.grid_field.clear(); + } + + pub fn has_grid_field(&self) -> bool { + self.grid_field.is_some() + } + + // Param is passed by value, moved + pub fn set_grid_field(&mut self, v: Field) { + self.grid_field = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_field(&mut self) -> &mut Field { + if self.grid_field.is_none() { + self.grid_field.set_default(); + } + self.grid_field.as_mut().unwrap() + } + + // Take field + pub fn take_grid_field(&mut self) -> Field { + self.grid_field.take().unwrap_or_else(|| Field::new()) + } + + // bytes type_option_data = 3; + + + pub fn get_type_option_data(&self) -> &[u8] { + &self.type_option_data + } + pub fn clear_type_option_data(&mut self) { + self.type_option_data.clear(); + } + + // Param is passed by value, moved + pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { + self.type_option_data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.type_option_data + } + + // Take field + pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for FieldTypeOptionContext { + fn is_initialized(&self) -> bool { + for v in &self.grid_field { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.grid_field)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if let Some(ref v) = self.grid_field.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.type_option_data.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if let Some(ref v) = self.grid_field.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.type_option_data.is_empty() { + os.write_bytes(3, &self.type_option_data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> FieldTypeOptionContext { + FieldTypeOptionContext::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &FieldTypeOptionContext| { &m.grid_id }, + |m: &mut FieldTypeOptionContext| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "grid_field", + |m: &FieldTypeOptionContext| { &m.grid_field }, + |m: &mut FieldTypeOptionContext| { &mut m.grid_field }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "type_option_data", + |m: &FieldTypeOptionContext| { &m.type_option_data }, + |m: &mut FieldTypeOptionContext| { &mut m.type_option_data }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "FieldTypeOptionContext", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static FieldTypeOptionContext { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(FieldTypeOptionContext::new) + } +} + +impl ::protobuf::Clear for FieldTypeOptionContext { + fn clear(&mut self) { + self.grid_id.clear(); + self.grid_field.clear(); + self.type_option_data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for FieldTypeOptionContext { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FieldTypeOptionContext { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct FieldTypeOptionData { + // message fields + pub grid_id: ::std::string::String, + pub field: ::protobuf::SingularPtrField, + pub type_option_data: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a FieldTypeOptionData { + fn default() -> &'a FieldTypeOptionData { + ::default_instance() + } +} + +impl FieldTypeOptionData { + pub fn new() -> FieldTypeOptionData { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // .Field field = 2; + + + pub fn get_field(&self) -> &Field { + self.field.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_field(&mut self) { + self.field.clear(); + } + + pub fn has_field(&self) -> bool { + self.field.is_some() + } + + // Param is passed by value, moved + pub fn set_field(&mut self, v: Field) { + self.field = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field(&mut self) -> &mut Field { + if self.field.is_none() { + self.field.set_default(); + } + self.field.as_mut().unwrap() + } + + // Take field + pub fn take_field(&mut self) -> Field { + self.field.take().unwrap_or_else(|| Field::new()) + } + + // bytes type_option_data = 3; + + + pub fn get_type_option_data(&self) -> &[u8] { + &self.type_option_data + } + pub fn clear_type_option_data(&mut self) { + self.type_option_data.clear(); + } + + // Param is passed by value, moved + pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { + self.type_option_data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.type_option_data + } + + // Take field + pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for FieldTypeOptionData { + fn is_initialized(&self) -> bool { + for v in &self.field { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if let Some(ref v) = self.field.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.type_option_data.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if let Some(ref v) = self.field.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.type_option_data.is_empty() { + os.write_bytes(3, &self.type_option_data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> FieldTypeOptionData { + FieldTypeOptionData::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &FieldTypeOptionData| { &m.grid_id }, + |m: &mut FieldTypeOptionData| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "field", + |m: &FieldTypeOptionData| { &m.field }, + |m: &mut FieldTypeOptionData| { &mut m.field }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "type_option_data", + |m: &FieldTypeOptionData| { &m.type_option_data }, + |m: &mut FieldTypeOptionData| { &mut m.type_option_data }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "FieldTypeOptionData", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static FieldTypeOptionData { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(FieldTypeOptionData::new) + } +} + +impl ::protobuf::Clear for FieldTypeOptionData { + fn clear(&mut self) { + self.grid_id.clear(); + self.field.clear(); + self.type_option_data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for FieldTypeOptionData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FieldTypeOptionData { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RepeatedField { + // message fields + pub items: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a RepeatedField { + fn default() -> &'a RepeatedField { + ::default_instance() + } +} + +impl RepeatedField { + pub fn new() -> RepeatedField { + ::std::default::Default::default() + } + + // repeated .Field items = 1; + + + pub fn get_items(&self) -> &[Field] { + &self.items + } + pub fn clear_items(&mut self) { + self.items.clear(); + } + + // Param is passed by value, moved + pub fn set_items(&mut self, v: ::protobuf::RepeatedField) { + self.items = v; + } + + // Mutable pointer to the field. + pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.items + } + + // Take field + pub fn take_items(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for RepeatedField { + fn is_initialized(&self) -> bool { + for v in &self.items { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.items)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.items { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.items { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> RepeatedField { + RepeatedField::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "items", + |m: &RepeatedField| { &m.items }, + |m: &mut RepeatedField| { &mut m.items }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "RepeatedField", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static RepeatedField { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(RepeatedField::new) + } +} + +impl ::protobuf::Clear for RepeatedField { + fn clear(&mut self) { + self.items.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RepeatedField { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RepeatedField { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RepeatedFieldOrder { + // message fields + pub items: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a RepeatedFieldOrder { + fn default() -> &'a RepeatedFieldOrder { + ::default_instance() + } +} + +impl RepeatedFieldOrder { + pub fn new() -> RepeatedFieldOrder { + ::std::default::Default::default() + } + + // repeated .FieldOrder items = 1; + + + pub fn get_items(&self) -> &[FieldOrder] { + &self.items + } + pub fn clear_items(&mut self) { + self.items.clear(); + } + + // Param is passed by value, moved + pub fn set_items(&mut self, v: ::protobuf::RepeatedField) { + self.items = v; + } + + // Mutable pointer to the field. + pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.items + } + + // Take field + pub fn take_items(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for RepeatedFieldOrder { + fn is_initialized(&self) -> bool { + for v in &self.items { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.items)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.items { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.items { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> RepeatedFieldOrder { + RepeatedFieldOrder::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "items", + |m: &RepeatedFieldOrder| { &m.items }, + |m: &mut RepeatedFieldOrder| { &mut m.items }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "RepeatedFieldOrder", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static RepeatedFieldOrder { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(RepeatedFieldOrder::new) + } +} + +impl ::protobuf::Clear for RepeatedFieldOrder { + fn clear(&mut self) { + self.items.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RepeatedFieldOrder { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RepeatedFieldOrder { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct InsertFieldPayload { + // message fields + pub grid_id: ::std::string::String, + pub field: ::protobuf::SingularPtrField, + pub type_option_data: ::std::vec::Vec, + // message oneof groups + pub one_of_start_field_id: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a InsertFieldPayload { + fn default() -> &'a InsertFieldPayload { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum InsertFieldPayload_oneof_one_of_start_field_id { + start_field_id(::std::string::String), +} + +impl InsertFieldPayload { + pub fn new() -> InsertFieldPayload { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // .Field field = 2; + + + pub fn get_field(&self) -> &Field { + self.field.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_field(&mut self) { + self.field.clear(); + } + + pub fn has_field(&self) -> bool { + self.field.is_some() + } + + // Param is passed by value, moved + pub fn set_field(&mut self, v: Field) { + self.field = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field(&mut self) -> &mut Field { + if self.field.is_none() { + self.field.set_default(); + } + self.field.as_mut().unwrap() + } + + // Take field + pub fn take_field(&mut self) -> Field { + self.field.take().unwrap_or_else(|| Field::new()) + } + + // bytes type_option_data = 3; + + + pub fn get_type_option_data(&self) -> &[u8] { + &self.type_option_data + } + pub fn clear_type_option_data(&mut self) { + self.type_option_data.clear(); + } + + // Param is passed by value, moved + pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { + self.type_option_data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.type_option_data + } + + // Take field + pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) + } + + // string start_field_id = 4; + + + pub fn get_start_field_id(&self) -> &str { + match self.one_of_start_field_id { + ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_start_field_id(&mut self) { + self.one_of_start_field_id = ::std::option::Option::None; + } + + pub fn has_start_field_id(&self) -> bool { + match self.one_of_start_field_id { + ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_start_field_id(&mut self, v: ::std::string::String) { + self.one_of_start_field_id = ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_start_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(_)) = self.one_of_start_field_id { + } else { + self.one_of_start_field_id = ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(::std::string::String::new())); + } + match self.one_of_start_field_id { + ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_start_field_id(&mut self) -> ::std::string::String { + if self.has_start_field_id() { + match self.one_of_start_field_id.take() { + ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } +} + +impl ::protobuf::Message for InsertFieldPayload { + fn is_initialized(&self) -> bool { + for v in &self.field { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_start_field_id = ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(is.read_string()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if let Some(ref v) = self.field.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.type_option_data.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); + } + if let ::std::option::Option::Some(ref v) = self.one_of_start_field_id { + match v { + &InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref v) => { + my_size += ::protobuf::rt::string_size(4, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if let Some(ref v) = self.field.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.type_option_data.is_empty() { + os.write_bytes(3, &self.type_option_data)?; + } + if let ::std::option::Option::Some(ref v) = self.one_of_start_field_id { + match v { + &InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref v) => { + os.write_string(4, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> InsertFieldPayload { + InsertFieldPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &InsertFieldPayload| { &m.grid_id }, + |m: &mut InsertFieldPayload| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "field", + |m: &InsertFieldPayload| { &m.field }, + |m: &mut InsertFieldPayload| { &mut m.field }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "type_option_data", + |m: &InsertFieldPayload| { &m.type_option_data }, + |m: &mut InsertFieldPayload| { &mut m.type_option_data }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "start_field_id", + InsertFieldPayload::has_start_field_id, + InsertFieldPayload::get_start_field_id, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "InsertFieldPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static InsertFieldPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(InsertFieldPayload::new) + } +} + +impl ::protobuf::Clear for InsertFieldPayload { + fn clear(&mut self) { + self.grid_id.clear(); + self.field.clear(); + self.type_option_data.clear(); + self.one_of_start_field_id = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for InsertFieldPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for InsertFieldPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct UpdateFieldTypeOptionPayload { + // message fields + pub grid_id: ::std::string::String, + pub field_id: ::std::string::String, + pub type_option_data: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a UpdateFieldTypeOptionPayload { + fn default() -> &'a UpdateFieldTypeOptionPayload { + ::default_instance() + } +} + +impl UpdateFieldTypeOptionPayload { + pub fn new() -> UpdateFieldTypeOptionPayload { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // string field_id = 2; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } + + // bytes type_option_data = 3; + + + pub fn get_type_option_data(&self) -> &[u8] { + &self.type_option_data + } + pub fn clear_type_option_data(&mut self) { + self.type_option_data.clear(); + } + + // Param is passed by value, moved + pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { + self.type_option_data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.type_option_data + } + + // Take field + pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for UpdateFieldTypeOptionPayload { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.field_id); + } + if !self.type_option_data.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if !self.field_id.is_empty() { + os.write_string(2, &self.field_id)?; + } + if !self.type_option_data.is_empty() { + os.write_bytes(3, &self.type_option_data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> UpdateFieldTypeOptionPayload { + UpdateFieldTypeOptionPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &UpdateFieldTypeOptionPayload| { &m.grid_id }, + |m: &mut UpdateFieldTypeOptionPayload| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &UpdateFieldTypeOptionPayload| { &m.field_id }, + |m: &mut UpdateFieldTypeOptionPayload| { &mut m.field_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "type_option_data", + |m: &UpdateFieldTypeOptionPayload| { &m.type_option_data }, + |m: &mut UpdateFieldTypeOptionPayload| { &mut m.type_option_data }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "UpdateFieldTypeOptionPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static UpdateFieldTypeOptionPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(UpdateFieldTypeOptionPayload::new) + } +} + +impl ::protobuf::Clear for UpdateFieldTypeOptionPayload { + fn clear(&mut self) { + self.grid_id.clear(); + self.field_id.clear(); + self.type_option_data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for UpdateFieldTypeOptionPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UpdateFieldTypeOptionPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct QueryFieldPayload { + // message fields + pub grid_id: ::std::string::String, + pub field_orders: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a QueryFieldPayload { + fn default() -> &'a QueryFieldPayload { + ::default_instance() + } +} + +impl QueryFieldPayload { + pub fn new() -> QueryFieldPayload { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // .RepeatedFieldOrder field_orders = 2; + + + pub fn get_field_orders(&self) -> &RepeatedFieldOrder { + self.field_orders.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_field_orders(&mut self) { + self.field_orders.clear(); + } + + pub fn has_field_orders(&self) -> bool { + self.field_orders.is_some() + } + + // Param is passed by value, moved + pub fn set_field_orders(&mut self, v: RepeatedFieldOrder) { + self.field_orders = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_orders(&mut self) -> &mut RepeatedFieldOrder { + if self.field_orders.is_none() { + self.field_orders.set_default(); + } + self.field_orders.as_mut().unwrap() + } + + // Take field + pub fn take_field_orders(&mut self) -> RepeatedFieldOrder { + self.field_orders.take().unwrap_or_else(|| RepeatedFieldOrder::new()) + } +} + +impl ::protobuf::Message for QueryFieldPayload { + fn is_initialized(&self) -> bool { + for v in &self.field_orders { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field_orders)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if let Some(ref v) = self.field_orders.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if let Some(ref v) = self.field_orders.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> QueryFieldPayload { + QueryFieldPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &QueryFieldPayload| { &m.grid_id }, + |m: &mut QueryFieldPayload| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "field_orders", + |m: &QueryFieldPayload| { &m.field_orders }, + |m: &mut QueryFieldPayload| { &mut m.field_orders }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "QueryFieldPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static QueryFieldPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(QueryFieldPayload::new) + } +} + +impl ::protobuf::Clear for QueryFieldPayload { + fn clear(&mut self) { + self.grid_id.clear(); + self.field_orders.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for QueryFieldPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for QueryFieldPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct FieldChangesetPayload { + // message fields + pub field_id: ::std::string::String, + pub grid_id: ::std::string::String, + // message oneof groups + pub one_of_name: ::std::option::Option, + pub one_of_desc: ::std::option::Option, + pub one_of_field_type: ::std::option::Option, + pub one_of_frozen: ::std::option::Option, + pub one_of_visibility: ::std::option::Option, + pub one_of_width: ::std::option::Option, + pub one_of_type_option_data: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a FieldChangesetPayload { + fn default() -> &'a FieldChangesetPayload { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum FieldChangesetPayload_oneof_one_of_name { + name(::std::string::String), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum FieldChangesetPayload_oneof_one_of_desc { + desc(::std::string::String), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum FieldChangesetPayload_oneof_one_of_field_type { + field_type(FieldType), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum FieldChangesetPayload_oneof_one_of_frozen { + frozen(bool), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum FieldChangesetPayload_oneof_one_of_visibility { + visibility(bool), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum FieldChangesetPayload_oneof_one_of_width { + width(i32), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum FieldChangesetPayload_oneof_one_of_type_option_data { + type_option_data(::std::vec::Vec), +} + +impl FieldChangesetPayload { + pub fn new() -> FieldChangesetPayload { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + &self.field_id + } + pub fn clear_field_id(&mut self) { + self.field_id.clear(); + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.field_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + &mut self.field_id + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) + } + + // string grid_id = 2; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // string name = 3; + + + pub fn get_name(&self) -> &str { + match self.one_of_name { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(ref v)) => v, + _ => "", + } + } + pub fn clear_name(&mut self) { + self.one_of_name = ::std::option::Option::None; + } + + pub fn has_name(&self) -> bool { + match self.one_of_name { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.one_of_name = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(v)) + } + + // Mutable pointer to the field. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(_)) = self.one_of_name { + } else { + self.one_of_name = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(::std::string::String::new())); + } + match self.one_of_name { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + if self.has_name() { + match self.one_of_name.take() { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } + + // string desc = 4; + + + pub fn get_desc(&self) -> &str { + match self.one_of_desc { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(ref v)) => v, + _ => "", + } + } + pub fn clear_desc(&mut self) { + self.one_of_desc = ::std::option::Option::None; + } + + pub fn has_desc(&self) -> bool { + match self.one_of_desc { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_desc(&mut self, v: ::std::string::String) { + self.one_of_desc = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(v)) + } + + // Mutable pointer to the field. + pub fn mut_desc(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(_)) = self.one_of_desc { + } else { + self.one_of_desc = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(::std::string::String::new())); + } + match self.one_of_desc { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_desc(&mut self) -> ::std::string::String { + if self.has_desc() { + match self.one_of_desc.take() { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } + + // .FieldType field_type = 5; + + + pub fn get_field_type(&self) -> FieldType { + match self.one_of_field_type { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(v)) => v, + _ => FieldType::RichText, + } + } + pub fn clear_field_type(&mut self) { + self.one_of_field_type = ::std::option::Option::None; + } + + pub fn has_field_type(&self) -> bool { + match self.one_of_field_type { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: FieldType) { + self.one_of_field_type = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(v)) + } + + // bool frozen = 6; + + + pub fn get_frozen(&self) -> bool { + match self.one_of_frozen { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(v)) => v, + _ => false, + } + } + pub fn clear_frozen(&mut self) { + self.one_of_frozen = ::std::option::Option::None; + } + + pub fn has_frozen(&self) -> bool { + match self.one_of_frozen { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_frozen(&mut self, v: bool) { + self.one_of_frozen = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(v)) + } + + // bool visibility = 7; + + + pub fn get_visibility(&self) -> bool { + match self.one_of_visibility { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(v)) => v, + _ => false, + } + } + pub fn clear_visibility(&mut self) { + self.one_of_visibility = ::std::option::Option::None; + } + + pub fn has_visibility(&self) -> bool { + match self.one_of_visibility { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_visibility(&mut self, v: bool) { + self.one_of_visibility = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(v)) + } + + // int32 width = 8; + + + pub fn get_width(&self) -> i32 { + match self.one_of_width { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(v)) => v, + _ => 0, + } + } + pub fn clear_width(&mut self) { + self.one_of_width = ::std::option::Option::None; + } + + pub fn has_width(&self) -> bool { + match self.one_of_width { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_width(&mut self, v: i32) { + self.one_of_width = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(v)) + } + + // bytes type_option_data = 9; + + + pub fn get_type_option_data(&self) -> &[u8] { + match self.one_of_type_option_data { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref v)) => v, + _ => &[], + } + } + pub fn clear_type_option_data(&mut self) { + self.one_of_type_option_data = ::std::option::Option::None; + } + + pub fn has_type_option_data(&self) -> bool { + match self.one_of_type_option_data { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { + self.one_of_type_option_data = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(v)) + } + + // Mutable pointer to the field. + pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { + if let ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(_)) = self.one_of_type_option_data { + } else { + self.one_of_type_option_data = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(::std::vec::Vec::new())); + } + match self.one_of_type_option_data { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { + if self.has_type_option_data() { + match self.one_of_type_option_data.take() { + ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(v)) => v, + _ => panic!(), + } + } else { + ::std::vec::Vec::new() + } + } +} + +impl ::protobuf::Message for FieldChangesetPayload { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_name = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(is.read_string()?)); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_desc = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(is.read_string()?)); + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_field_type = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(is.read_enum()?)); + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_frozen = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(is.read_bool()?)); + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_visibility = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(is.read_bool()?)); + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_width = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(is.read_int32()?)); + }, + 9 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_type_option_data = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(is.read_bytes()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.field_id); + } + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.grid_id); + } + if let ::std::option::Option::Some(ref v) = self.one_of_name { + match v { + &FieldChangesetPayload_oneof_one_of_name::name(ref v) => { + my_size += ::protobuf::rt::string_size(3, &v); + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_desc { + match v { + &FieldChangesetPayload_oneof_one_of_desc::desc(ref v) => { + my_size += ::protobuf::rt::string_size(4, &v); + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_field_type { + match v { + &FieldChangesetPayload_oneof_one_of_field_type::field_type(v) => { + my_size += ::protobuf::rt::enum_size(5, v); + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_frozen { + match v { + &FieldChangesetPayload_oneof_one_of_frozen::frozen(v) => { + my_size += 2; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_visibility { + match v { + &FieldChangesetPayload_oneof_one_of_visibility::visibility(v) => { + my_size += 2; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_width { + match v { + &FieldChangesetPayload_oneof_one_of_width::width(v) => { + my_size += ::protobuf::rt::value_size(8, v, ::protobuf::wire_format::WireTypeVarint); + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_type_option_data { + match v { + &FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref v) => { + my_size += ::protobuf::rt::bytes_size(9, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.field_id.is_empty() { + os.write_string(1, &self.field_id)?; + } + if !self.grid_id.is_empty() { + os.write_string(2, &self.grid_id)?; + } + if let ::std::option::Option::Some(ref v) = self.one_of_name { + match v { + &FieldChangesetPayload_oneof_one_of_name::name(ref v) => { + os.write_string(3, v)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_desc { + match v { + &FieldChangesetPayload_oneof_one_of_desc::desc(ref v) => { + os.write_string(4, v)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_field_type { + match v { + &FieldChangesetPayload_oneof_one_of_field_type::field_type(v) => { + os.write_enum(5, ::protobuf::ProtobufEnum::value(&v))?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_frozen { + match v { + &FieldChangesetPayload_oneof_one_of_frozen::frozen(v) => { + os.write_bool(6, v)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_visibility { + match v { + &FieldChangesetPayload_oneof_one_of_visibility::visibility(v) => { + os.write_bool(7, v)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_width { + match v { + &FieldChangesetPayload_oneof_one_of_width::width(v) => { + os.write_int32(8, v)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_type_option_data { + match v { + &FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref v) => { + os.write_bytes(9, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> FieldChangesetPayload { + FieldChangesetPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &FieldChangesetPayload| { &m.field_id }, + |m: &mut FieldChangesetPayload| { &mut m.field_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &FieldChangesetPayload| { &m.grid_id }, + |m: &mut FieldChangesetPayload| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "name", + FieldChangesetPayload::has_name, + FieldChangesetPayload::get_name, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "desc", + FieldChangesetPayload::has_desc, + FieldChangesetPayload::get_desc, + )); + fields.push(::protobuf::reflect::accessor::make_singular_enum_accessor::<_, FieldType>( + "field_type", + FieldChangesetPayload::has_field_type, + FieldChangesetPayload::get_field_type, + )); + fields.push(::protobuf::reflect::accessor::make_singular_bool_accessor::<_>( + "frozen", + FieldChangesetPayload::has_frozen, + FieldChangesetPayload::get_frozen, + )); + fields.push(::protobuf::reflect::accessor::make_singular_bool_accessor::<_>( + "visibility", + FieldChangesetPayload::has_visibility, + FieldChangesetPayload::get_visibility, + )); + fields.push(::protobuf::reflect::accessor::make_singular_i32_accessor::<_>( + "width", + FieldChangesetPayload::has_width, + FieldChangesetPayload::get_width, + )); + fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>( + "type_option_data", + FieldChangesetPayload::has_type_option_data, + FieldChangesetPayload::get_type_option_data, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "FieldChangesetPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static FieldChangesetPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(FieldChangesetPayload::new) + } +} + +impl ::protobuf::Clear for FieldChangesetPayload { + fn clear(&mut self) { + self.field_id.clear(); + self.grid_id.clear(); + self.one_of_name = ::std::option::Option::None; + self.one_of_desc = ::std::option::Option::None; + self.one_of_field_type = ::std::option::Option::None; + self.one_of_frozen = ::std::option::Option::None; + self.one_of_visibility = ::std::option::Option::None; + self.one_of_width = ::std::option::Option::None; + self.one_of_type_option_data = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for FieldChangesetPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FieldChangesetPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum FieldType { + RichText = 0, + Number = 1, + DateTime = 2, + SingleSelect = 3, + MultiSelect = 4, + Checkbox = 5, + URL = 6, +} + +impl ::protobuf::ProtobufEnum for FieldType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(FieldType::RichText), + 1 => ::std::option::Option::Some(FieldType::Number), + 2 => ::std::option::Option::Some(FieldType::DateTime), + 3 => ::std::option::Option::Some(FieldType::SingleSelect), + 4 => ::std::option::Option::Some(FieldType::MultiSelect), + 5 => ::std::option::Option::Some(FieldType::Checkbox), + 6 => ::std::option::Option::Some(FieldType::URL), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [FieldType] = &[ + FieldType::RichText, + FieldType::Number, + FieldType::DateTime, + FieldType::SingleSelect, + FieldType::MultiSelect, + FieldType::Checkbox, + FieldType::URL, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("FieldType", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for FieldType { +} + +impl ::std::default::Default for FieldType { + fn default() -> Self { + FieldType::RichText + } +} + +impl ::protobuf::reflect::ProtobufValue for FieldType { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0bfield.proto\"\xd7\x01\n\x05Field\x12\x0e\n\x02id\x18\x01\x20\x01(\ + \tR\x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04des\ + c\x18\x03\x20\x01(\tR\x04desc\x12)\n\nfield_type\x18\x04\x20\x01(\x0e2\n\ + .FieldTypeR\tfieldType\x12\x16\n\x06frozen\x18\x05\x20\x01(\x08R\x06froz\ + en\x12\x1e\n\nvisibility\x18\x06\x20\x01(\x08R\nvisibility\x12\x14\n\x05\ + width\x18\x07\x20\x01(\x05R\x05width\x12\x1d\n\nis_primary\x18\x08\x20\ + \x01(\x08R\tisPrimary\"'\n\nFieldOrder\x12\x19\n\x08field_id\x18\x01\x20\ + \x01(\tR\x07fieldId\"\xc6\x01\n\x12GridFieldChangeset\x12\x17\n\x07grid_\ + id\x18\x01\x20\x01(\tR\x06gridId\x124\n\x0finserted_fields\x18\x02\x20\ + \x03(\x0b2\x0b.IndexFieldR\x0einsertedFields\x122\n\x0edeleted_fields\ + \x18\x03\x20\x03(\x0b2\x0b.FieldOrderR\rdeletedFields\x12-\n\x0eupdated_\ + fields\x18\x04\x20\x03(\x0b2\x06.FieldR\rupdatedFields\"@\n\nIndexField\ + \x12\x1c\n\x05field\x18\x01\x20\x01(\x0b2\x06.FieldR\x05field\x12\x14\n\ + \x05index\x18\x02\x20\x01(\x05R\x05index\"\x90\x01\n\x1aGetEditFieldCont\ + extPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\x1b\n\ + \x08field_id\x18\x02\x20\x01(\tH\0R\x07fieldId\x12)\n\nfield_type\x18\ + \x03\x20\x01(\x0e2\n.FieldTypeR\tfieldTypeB\x11\n\x0fone_of_field_id\"\ + \xa0\x01\n\x10EditFieldPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\ + \x06gridId\x12\x19\n\x08field_id\x18\x02\x20\x01(\tR\x07fieldId\x12)\n\n\ + field_type\x18\x03\x20\x01(\x0e2\n.FieldTypeR\tfieldType\x12-\n\x13creat\ + e_if_not_exist\x18\x04\x20\x01(\x08R\x10createIfNotExist\"\x82\x01\n\x16\ + FieldTypeOptionContext\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridI\ + d\x12%\n\ngrid_field\x18\x02\x20\x01(\x0b2\x06.FieldR\tgridField\x12(\n\ + \x10type_option_data\x18\x03\x20\x01(\x0cR\x0etypeOptionData\"v\n\x13Fie\ + ldTypeOptionData\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\ + \x1c\n\x05field\x18\x02\x20\x01(\x0b2\x06.FieldR\x05field\x12(\n\x10type\ + _option_data\x18\x03\x20\x01(\x0cR\x0etypeOptionData\"-\n\rRepeatedField\ + \x12\x1c\n\x05items\x18\x01\x20\x03(\x0b2\x06.FieldR\x05items\"7\n\x12Re\ + peatedFieldOrder\x12!\n\x05items\x18\x01\x20\x03(\x0b2\x0b.FieldOrderR\ + \x05items\"\xb6\x01\n\x12InsertFieldPayload\x12\x17\n\x07grid_id\x18\x01\ + \x20\x01(\tR\x06gridId\x12\x1c\n\x05field\x18\x02\x20\x01(\x0b2\x06.Fiel\ + dR\x05field\x12(\n\x10type_option_data\x18\x03\x20\x01(\x0cR\x0etypeOpti\ + onData\x12&\n\x0estart_field_id\x18\x04\x20\x01(\tH\0R\x0cstartFieldIdB\ + \x17\n\x15one_of_start_field_id\"|\n\x1cUpdateFieldTypeOptionPayload\x12\ + \x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\x19\n\x08field_id\ + \x18\x02\x20\x01(\tR\x07fieldId\x12(\n\x10type_option_data\x18\x03\x20\ + \x01(\x0cR\x0etypeOptionData\"d\n\x11QueryFieldPayload\x12\x17\n\x07grid\ + _id\x18\x01\x20\x01(\tR\x06gridId\x126\n\x0cfield_orders\x18\x02\x20\x01\ + (\x0b2\x13.RepeatedFieldOrderR\x0bfieldOrders\"\xa8\x03\n\x15FieldChange\ + setPayload\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\x12\x17\ + \n\x07grid_id\x18\x02\x20\x01(\tR\x06gridId\x12\x14\n\x04name\x18\x03\ + \x20\x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\x04\x20\x01(\tH\x01R\x04de\ + sc\x12+\n\nfield_type\x18\x05\x20\x01(\x0e2\n.FieldTypeH\x02R\tfieldType\ + \x12\x18\n\x06frozen\x18\x06\x20\x01(\x08H\x03R\x06frozen\x12\x20\n\nvis\ + ibility\x18\x07\x20\x01(\x08H\x04R\nvisibility\x12\x16\n\x05width\x18\ + \x08\x20\x01(\x05H\x05R\x05width\x12*\n\x10type_option_data\x18\t\x20\ + \x01(\x0cH\x06R\x0etypeOptionDataB\r\n\x0bone_of_nameB\r\n\x0bone_of_des\ + cB\x13\n\x11one_of_field_typeB\x0f\n\rone_of_frozenB\x13\n\x11one_of_vis\ + ibilityB\x0e\n\x0cone_of_widthB\x19\n\x17one_of_type_option_data*m\n\tFi\ + eldType\x12\x0c\n\x08RichText\x10\0\x12\n\n\x06Number\x10\x01\x12\x0c\n\ + \x08DateTime\x10\x02\x12\x10\n\x0cSingleSelect\x10\x03\x12\x0f\n\x0bMult\ + iSelect\x10\x04\x12\x0c\n\x08Checkbox\x10\x05\x12\x07\n\x03URL\x10\x06b\ + \x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs b/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs index c087cc5ea3..fae8c14360 100644 --- a/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs +++ b/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs @@ -27,7 +27,7 @@ pub struct Grid { // message fields pub id: ::std::string::String, - pub field_orders: ::protobuf::RepeatedField, + pub field_orders: ::protobuf::RepeatedField, pub block_orders: ::protobuf::RepeatedField, // special fields pub unknown_fields: ::protobuf::UnknownFields, @@ -74,7 +74,7 @@ impl Grid { // repeated .FieldOrder field_orders = 2; - pub fn get_field_orders(&self) -> &[FieldOrder] { + pub fn get_field_orders(&self) -> &[super::field::FieldOrder] { &self.field_orders } pub fn clear_field_orders(&mut self) { @@ -82,17 +82,17 @@ impl Grid { } // Param is passed by value, moved - pub fn set_field_orders(&mut self, v: ::protobuf::RepeatedField) { + pub fn set_field_orders(&mut self, v: ::protobuf::RepeatedField) { self.field_orders = v; } // Mutable pointer to the field. - pub fn mut_field_orders(&mut self) -> &mut ::protobuf::RepeatedField { + pub fn mut_field_orders(&mut self) -> &mut ::protobuf::RepeatedField { &mut self.field_orders } // Take field - pub fn take_field_orders(&mut self) -> ::protobuf::RepeatedField { + pub fn take_field_orders(&mut self) -> ::protobuf::RepeatedField { ::std::mem::replace(&mut self.field_orders, ::protobuf::RepeatedField::new()) } @@ -235,7 +235,7 @@ impl ::protobuf::Message for Grid { |m: &Grid| { &m.id }, |m: &mut Grid| { &mut m.id }, )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "field_orders", |m: &Grid| { &m.field_orders }, |m: &mut Grid| { &mut m.field_orders }, @@ -280,2481 +280,6 @@ impl ::protobuf::reflect::ProtobufValue for Grid { } } -#[derive(PartialEq,Clone,Default)] -pub struct Field { - // message fields - pub id: ::std::string::String, - pub name: ::std::string::String, - pub desc: ::std::string::String, - pub field_type: FieldType, - pub frozen: bool, - pub visibility: bool, - pub width: i32, - pub is_primary: bool, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Field { - fn default() -> &'a Field { - ::default_instance() - } -} - -impl Field { - pub fn new() -> Field { - ::std::default::Default::default() - } - - // string id = 1; - - - pub fn get_id(&self) -> &str { - &self.id - } - pub fn clear_id(&mut self) { - self.id.clear(); - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::string::String) { - self.id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::string::String { - &mut self.id - } - - // Take field - pub fn take_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.id, ::std::string::String::new()) - } - - // string name = 2; - - - pub fn get_name(&self) -> &str { - &self.name - } - pub fn clear_name(&mut self) { - self.name.clear(); - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - &mut self.name - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.name, ::std::string::String::new()) - } - - // string desc = 3; - - - pub fn get_desc(&self) -> &str { - &self.desc - } - pub fn clear_desc(&mut self) { - self.desc.clear(); - } - - // Param is passed by value, moved - pub fn set_desc(&mut self, v: ::std::string::String) { - self.desc = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_desc(&mut self) -> &mut ::std::string::String { - &mut self.desc - } - - // Take field - pub fn take_desc(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.desc, ::std::string::String::new()) - } - - // .FieldType field_type = 4; - - - pub fn get_field_type(&self) -> FieldType { - self.field_type - } - pub fn clear_field_type(&mut self) { - self.field_type = FieldType::RichText; - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: FieldType) { - self.field_type = v; - } - - // bool frozen = 5; - - - pub fn get_frozen(&self) -> bool { - self.frozen - } - pub fn clear_frozen(&mut self) { - self.frozen = false; - } - - // Param is passed by value, moved - pub fn set_frozen(&mut self, v: bool) { - self.frozen = v; - } - - // bool visibility = 6; - - - pub fn get_visibility(&self) -> bool { - self.visibility - } - pub fn clear_visibility(&mut self) { - self.visibility = false; - } - - // Param is passed by value, moved - pub fn set_visibility(&mut self, v: bool) { - self.visibility = v; - } - - // int32 width = 7; - - - pub fn get_width(&self) -> i32 { - self.width - } - pub fn clear_width(&mut self) { - self.width = 0; - } - - // Param is passed by value, moved - pub fn set_width(&mut self, v: i32) { - self.width = v; - } - - // bool is_primary = 8; - - - pub fn get_is_primary(&self) -> bool { - self.is_primary - } - pub fn clear_is_primary(&mut self) { - self.is_primary = false; - } - - // Param is passed by value, moved - pub fn set_is_primary(&mut self, v: bool) { - self.is_primary = v; - } -} - -impl ::protobuf::Message for Field { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.desc)?; - }, - 4 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 4, &mut self.unknown_fields)? - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.frozen = tmp; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.visibility = tmp; - }, - 7 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int32()?; - self.width = tmp; - }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.is_primary = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.id); - } - if !self.name.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.name); - } - if !self.desc.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.desc); - } - if self.field_type != FieldType::RichText { - my_size += ::protobuf::rt::enum_size(4, self.field_type); - } - if self.frozen != false { - my_size += 2; - } - if self.visibility != false { - my_size += 2; - } - if self.width != 0 { - my_size += ::protobuf::rt::value_size(7, self.width, ::protobuf::wire_format::WireTypeVarint); - } - if self.is_primary != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.id.is_empty() { - os.write_string(1, &self.id)?; - } - if !self.name.is_empty() { - os.write_string(2, &self.name)?; - } - if !self.desc.is_empty() { - os.write_string(3, &self.desc)?; - } - if self.field_type != FieldType::RichText { - os.write_enum(4, ::protobuf::ProtobufEnum::value(&self.field_type))?; - } - if self.frozen != false { - os.write_bool(5, self.frozen)?; - } - if self.visibility != false { - os.write_bool(6, self.visibility)?; - } - if self.width != 0 { - os.write_int32(7, self.width)?; - } - if self.is_primary != false { - os.write_bool(8, self.is_primary)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Field { - Field::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "id", - |m: &Field| { &m.id }, - |m: &mut Field| { &mut m.id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - |m: &Field| { &m.name }, - |m: &mut Field| { &mut m.name }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "desc", - |m: &Field| { &m.desc }, - |m: &mut Field| { &mut m.desc }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "field_type", - |m: &Field| { &m.field_type }, - |m: &mut Field| { &mut m.field_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "frozen", - |m: &Field| { &m.frozen }, - |m: &mut Field| { &mut m.frozen }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "visibility", - |m: &Field| { &m.visibility }, - |m: &mut Field| { &mut m.visibility }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( - "width", - |m: &Field| { &m.width }, - |m: &mut Field| { &mut m.width }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "is_primary", - |m: &Field| { &m.is_primary }, - |m: &mut Field| { &mut m.is_primary }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "Field", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static Field { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(Field::new) - } -} - -impl ::protobuf::Clear for Field { - fn clear(&mut self) { - self.id.clear(); - self.name.clear(); - self.desc.clear(); - self.field_type = FieldType::RichText; - self.frozen = false; - self.visibility = false; - self.width = 0; - self.is_primary = false; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Field { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Field { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FieldOrder { - // message fields - pub field_id: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a FieldOrder { - fn default() -> &'a FieldOrder { - ::default_instance() - } -} - -impl FieldOrder { - pub fn new() -> FieldOrder { - ::std::default::Default::default() - } - - // string field_id = 1; - - - pub fn get_field_id(&self) -> &str { - &self.field_id - } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); - } - - // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id - } - - // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) - } -} - -impl ::protobuf::Message for FieldOrder { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.field_id); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.field_id.is_empty() { - os.write_string(1, &self.field_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FieldOrder { - FieldOrder::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &FieldOrder| { &m.field_id }, - |m: &mut FieldOrder| { &mut m.field_id }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "FieldOrder", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static FieldOrder { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(FieldOrder::new) - } -} - -impl ::protobuf::Clear for FieldOrder { - fn clear(&mut self) { - self.field_id.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FieldOrder { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FieldOrder { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GridFieldChangeset { - // message fields - pub grid_id: ::std::string::String, - pub inserted_fields: ::protobuf::RepeatedField, - pub deleted_fields: ::protobuf::RepeatedField, - pub updated_fields: ::protobuf::RepeatedField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a GridFieldChangeset { - fn default() -> &'a GridFieldChangeset { - ::default_instance() - } -} - -impl GridFieldChangeset { - pub fn new() -> GridFieldChangeset { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // repeated .IndexField inserted_fields = 2; - - - pub fn get_inserted_fields(&self) -> &[IndexField] { - &self.inserted_fields - } - pub fn clear_inserted_fields(&mut self) { - self.inserted_fields.clear(); - } - - // Param is passed by value, moved - pub fn set_inserted_fields(&mut self, v: ::protobuf::RepeatedField) { - self.inserted_fields = v; - } - - // Mutable pointer to the field. - pub fn mut_inserted_fields(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.inserted_fields - } - - // Take field - pub fn take_inserted_fields(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.inserted_fields, ::protobuf::RepeatedField::new()) - } - - // repeated .FieldOrder deleted_fields = 3; - - - pub fn get_deleted_fields(&self) -> &[FieldOrder] { - &self.deleted_fields - } - pub fn clear_deleted_fields(&mut self) { - self.deleted_fields.clear(); - } - - // Param is passed by value, moved - pub fn set_deleted_fields(&mut self, v: ::protobuf::RepeatedField) { - self.deleted_fields = v; - } - - // Mutable pointer to the field. - pub fn mut_deleted_fields(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.deleted_fields - } - - // Take field - pub fn take_deleted_fields(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.deleted_fields, ::protobuf::RepeatedField::new()) - } - - // repeated .Field updated_fields = 4; - - - pub fn get_updated_fields(&self) -> &[Field] { - &self.updated_fields - } - pub fn clear_updated_fields(&mut self) { - self.updated_fields.clear(); - } - - // Param is passed by value, moved - pub fn set_updated_fields(&mut self, v: ::protobuf::RepeatedField) { - self.updated_fields = v; - } - - // Mutable pointer to the field. - pub fn mut_updated_fields(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.updated_fields - } - - // Take field - pub fn take_updated_fields(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.updated_fields, ::protobuf::RepeatedField::new()) - } -} - -impl ::protobuf::Message for GridFieldChangeset { - fn is_initialized(&self) -> bool { - for v in &self.inserted_fields { - if !v.is_initialized() { - return false; - } - }; - for v in &self.deleted_fields { - if !v.is_initialized() { - return false; - } - }; - for v in &self.updated_fields { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.inserted_fields)?; - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.deleted_fields)?; - }, - 4 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.updated_fields)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - for value in &self.inserted_fields { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - for value in &self.deleted_fields { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - for value in &self.updated_fields { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - for v in &self.inserted_fields { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - for v in &self.deleted_fields { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - for v in &self.updated_fields { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> GridFieldChangeset { - GridFieldChangeset::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &GridFieldChangeset| { &m.grid_id }, - |m: &mut GridFieldChangeset| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "inserted_fields", - |m: &GridFieldChangeset| { &m.inserted_fields }, - |m: &mut GridFieldChangeset| { &mut m.inserted_fields }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "deleted_fields", - |m: &GridFieldChangeset| { &m.deleted_fields }, - |m: &mut GridFieldChangeset| { &mut m.deleted_fields }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "updated_fields", - |m: &GridFieldChangeset| { &m.updated_fields }, - |m: &mut GridFieldChangeset| { &mut m.updated_fields }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "GridFieldChangeset", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static GridFieldChangeset { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(GridFieldChangeset::new) - } -} - -impl ::protobuf::Clear for GridFieldChangeset { - fn clear(&mut self) { - self.grid_id.clear(); - self.inserted_fields.clear(); - self.deleted_fields.clear(); - self.updated_fields.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GridFieldChangeset { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GridFieldChangeset { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct IndexField { - // message fields - pub field: ::protobuf::SingularPtrField, - pub index: i32, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a IndexField { - fn default() -> &'a IndexField { - ::default_instance() - } -} - -impl IndexField { - pub fn new() -> IndexField { - ::std::default::Default::default() - } - - // .Field field = 1; - - - pub fn get_field(&self) -> &Field { - self.field.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_field(&mut self) { - self.field.clear(); - } - - pub fn has_field(&self) -> bool { - self.field.is_some() - } - - // Param is passed by value, moved - pub fn set_field(&mut self, v: Field) { - self.field = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field(&mut self) -> &mut Field { - if self.field.is_none() { - self.field.set_default(); - } - self.field.as_mut().unwrap() - } - - // Take field - pub fn take_field(&mut self) -> Field { - self.field.take().unwrap_or_else(|| Field::new()) - } - - // int32 index = 2; - - - pub fn get_index(&self) -> i32 { - self.index - } - pub fn clear_index(&mut self) { - self.index = 0; - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: i32) { - self.index = v; - } -} - -impl ::protobuf::Message for IndexField { - fn is_initialized(&self) -> bool { - for v in &self.field { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int32()?; - self.index = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.field.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.index != 0 { - my_size += ::protobuf::rt::value_size(2, self.index, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.field.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.index != 0 { - os.write_int32(2, self.index)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> IndexField { - IndexField::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "field", - |m: &IndexField| { &m.field }, - |m: &mut IndexField| { &mut m.field }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( - "index", - |m: &IndexField| { &m.index }, - |m: &mut IndexField| { &mut m.index }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "IndexField", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static IndexField { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(IndexField::new) - } -} - -impl ::protobuf::Clear for IndexField { - fn clear(&mut self) { - self.field.clear(); - self.index = 0; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for IndexField { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for IndexField { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetEditFieldContextPayload { - // message fields - pub grid_id: ::std::string::String, - pub field_type: FieldType, - // message oneof groups - pub one_of_field_id: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a GetEditFieldContextPayload { - fn default() -> &'a GetEditFieldContextPayload { - ::default_instance() - } -} - -#[derive(Clone,PartialEq,Debug)] -pub enum GetEditFieldContextPayload_oneof_one_of_field_id { - field_id(::std::string::String), -} - -impl GetEditFieldContextPayload { - pub fn new() -> GetEditFieldContextPayload { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // string field_id = 2; - - - pub fn get_field_id(&self) -> &str { - match self.one_of_field_id { - ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref v)) => v, - _ => "", - } - } - pub fn clear_field_id(&mut self) { - self.one_of_field_id = ::std::option::Option::None; - } - - pub fn has_field_id(&self) -> bool { - match self.one_of_field_id { - ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.one_of_field_id = ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(v)) - } - - // Mutable pointer to the field. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(_)) = self.one_of_field_id { - } else { - self.one_of_field_id = ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(::std::string::String::new())); - } - match self.one_of_field_id { - ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - if self.has_field_id() { - match self.one_of_field_id.take() { - ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } - - // .FieldType field_type = 3; - - - pub fn get_field_type(&self) -> FieldType { - self.field_type - } - pub fn clear_field_type(&mut self) { - self.field_type = FieldType::RichText; - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: FieldType) { - self.field_type = v; - } -} - -impl ::protobuf::Message for GetEditFieldContextPayload { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_field_id = ::std::option::Option::Some(GetEditFieldContextPayload_oneof_one_of_field_id::field_id(is.read_string()?)); - }, - 3 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 3, &mut self.unknown_fields)? - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - if self.field_type != FieldType::RichText { - my_size += ::protobuf::rt::enum_size(3, self.field_type); - } - if let ::std::option::Option::Some(ref v) = self.one_of_field_id { - match v { - &GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref v) => { - my_size += ::protobuf::rt::string_size(2, &v); - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - if self.field_type != FieldType::RichText { - os.write_enum(3, ::protobuf::ProtobufEnum::value(&self.field_type))?; - } - if let ::std::option::Option::Some(ref v) = self.one_of_field_id { - match v { - &GetEditFieldContextPayload_oneof_one_of_field_id::field_id(ref v) => { - os.write_string(2, v)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> GetEditFieldContextPayload { - GetEditFieldContextPayload::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &GetEditFieldContextPayload| { &m.grid_id }, - |m: &mut GetEditFieldContextPayload| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "field_id", - GetEditFieldContextPayload::has_field_id, - GetEditFieldContextPayload::get_field_id, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "field_type", - |m: &GetEditFieldContextPayload| { &m.field_type }, - |m: &mut GetEditFieldContextPayload| { &mut m.field_type }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "GetEditFieldContextPayload", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static GetEditFieldContextPayload { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(GetEditFieldContextPayload::new) - } -} - -impl ::protobuf::Clear for GetEditFieldContextPayload { - fn clear(&mut self) { - self.grid_id.clear(); - self.one_of_field_id = ::std::option::Option::None; - self.field_type = FieldType::RichText; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetEditFieldContextPayload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetEditFieldContextPayload { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct EditFieldPayload { - // message fields - pub grid_id: ::std::string::String, - pub field_id: ::std::string::String, - pub field_type: FieldType, - pub create_if_not_exist: bool, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a EditFieldPayload { - fn default() -> &'a EditFieldPayload { - ::default_instance() - } -} - -impl EditFieldPayload { - pub fn new() -> EditFieldPayload { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // string field_id = 2; - - - pub fn get_field_id(&self) -> &str { - &self.field_id - } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); - } - - // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id - } - - // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) - } - - // .FieldType field_type = 3; - - - pub fn get_field_type(&self) -> FieldType { - self.field_type - } - pub fn clear_field_type(&mut self) { - self.field_type = FieldType::RichText; - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: FieldType) { - self.field_type = v; - } - - // bool create_if_not_exist = 4; - - - pub fn get_create_if_not_exist(&self) -> bool { - self.create_if_not_exist - } - pub fn clear_create_if_not_exist(&mut self) { - self.create_if_not_exist = false; - } - - // Param is passed by value, moved - pub fn set_create_if_not_exist(&mut self, v: bool) { - self.create_if_not_exist = v; - } -} - -impl ::protobuf::Message for EditFieldPayload { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; - }, - 3 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 3, &mut self.unknown_fields)? - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.create_if_not_exist = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.field_id); - } - if self.field_type != FieldType::RichText { - my_size += ::protobuf::rt::enum_size(3, self.field_type); - } - if self.create_if_not_exist != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - if !self.field_id.is_empty() { - os.write_string(2, &self.field_id)?; - } - if self.field_type != FieldType::RichText { - os.write_enum(3, ::protobuf::ProtobufEnum::value(&self.field_type))?; - } - if self.create_if_not_exist != false { - os.write_bool(4, self.create_if_not_exist)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> EditFieldPayload { - EditFieldPayload::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &EditFieldPayload| { &m.grid_id }, - |m: &mut EditFieldPayload| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &EditFieldPayload| { &m.field_id }, - |m: &mut EditFieldPayload| { &mut m.field_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "field_type", - |m: &EditFieldPayload| { &m.field_type }, - |m: &mut EditFieldPayload| { &mut m.field_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "create_if_not_exist", - |m: &EditFieldPayload| { &m.create_if_not_exist }, - |m: &mut EditFieldPayload| { &mut m.create_if_not_exist }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "EditFieldPayload", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static EditFieldPayload { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(EditFieldPayload::new) - } -} - -impl ::protobuf::Clear for EditFieldPayload { - fn clear(&mut self) { - self.grid_id.clear(); - self.field_id.clear(); - self.field_type = FieldType::RichText; - self.create_if_not_exist = false; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for EditFieldPayload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for EditFieldPayload { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FieldTypeOptionContext { - // message fields - pub grid_id: ::std::string::String, - pub grid_field: ::protobuf::SingularPtrField, - pub type_option_data: ::std::vec::Vec, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a FieldTypeOptionContext { - fn default() -> &'a FieldTypeOptionContext { - ::default_instance() - } -} - -impl FieldTypeOptionContext { - pub fn new() -> FieldTypeOptionContext { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // .Field grid_field = 2; - - - pub fn get_grid_field(&self) -> &Field { - self.grid_field.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_grid_field(&mut self) { - self.grid_field.clear(); - } - - pub fn has_grid_field(&self) -> bool { - self.grid_field.is_some() - } - - // Param is passed by value, moved - pub fn set_grid_field(&mut self, v: Field) { - self.grid_field = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_field(&mut self) -> &mut Field { - if self.grid_field.is_none() { - self.grid_field.set_default(); - } - self.grid_field.as_mut().unwrap() - } - - // Take field - pub fn take_grid_field(&mut self) -> Field { - self.grid_field.take().unwrap_or_else(|| Field::new()) - } - - // bytes type_option_data = 3; - - - pub fn get_type_option_data(&self) -> &[u8] { - &self.type_option_data - } - pub fn clear_type_option_data(&mut self) { - self.type_option_data.clear(); - } - - // Param is passed by value, moved - pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { - self.type_option_data = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { - &mut self.type_option_data - } - - // Take field - pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) - } -} - -impl ::protobuf::Message for FieldTypeOptionContext { - fn is_initialized(&self) -> bool { - for v in &self.grid_field { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.grid_field)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - if let Some(ref v) = self.grid_field.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.type_option_data.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - if let Some(ref v) = self.grid_field.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.type_option_data.is_empty() { - os.write_bytes(3, &self.type_option_data)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FieldTypeOptionContext { - FieldTypeOptionContext::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &FieldTypeOptionContext| { &m.grid_id }, - |m: &mut FieldTypeOptionContext| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "grid_field", - |m: &FieldTypeOptionContext| { &m.grid_field }, - |m: &mut FieldTypeOptionContext| { &mut m.grid_field }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "type_option_data", - |m: &FieldTypeOptionContext| { &m.type_option_data }, - |m: &mut FieldTypeOptionContext| { &mut m.type_option_data }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "FieldTypeOptionContext", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static FieldTypeOptionContext { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(FieldTypeOptionContext::new) - } -} - -impl ::protobuf::Clear for FieldTypeOptionContext { - fn clear(&mut self) { - self.grid_id.clear(); - self.grid_field.clear(); - self.type_option_data.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FieldTypeOptionContext { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FieldTypeOptionContext { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FieldTypeOptionData { - // message fields - pub grid_id: ::std::string::String, - pub field: ::protobuf::SingularPtrField, - pub type_option_data: ::std::vec::Vec, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a FieldTypeOptionData { - fn default() -> &'a FieldTypeOptionData { - ::default_instance() - } -} - -impl FieldTypeOptionData { - pub fn new() -> FieldTypeOptionData { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // .Field field = 2; - - - pub fn get_field(&self) -> &Field { - self.field.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_field(&mut self) { - self.field.clear(); - } - - pub fn has_field(&self) -> bool { - self.field.is_some() - } - - // Param is passed by value, moved - pub fn set_field(&mut self, v: Field) { - self.field = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field(&mut self) -> &mut Field { - if self.field.is_none() { - self.field.set_default(); - } - self.field.as_mut().unwrap() - } - - // Take field - pub fn take_field(&mut self) -> Field { - self.field.take().unwrap_or_else(|| Field::new()) - } - - // bytes type_option_data = 3; - - - pub fn get_type_option_data(&self) -> &[u8] { - &self.type_option_data - } - pub fn clear_type_option_data(&mut self) { - self.type_option_data.clear(); - } - - // Param is passed by value, moved - pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { - self.type_option_data = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { - &mut self.type_option_data - } - - // Take field - pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) - } -} - -impl ::protobuf::Message for FieldTypeOptionData { - fn is_initialized(&self) -> bool { - for v in &self.field { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - if let Some(ref v) = self.field.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.type_option_data.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - if let Some(ref v) = self.field.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.type_option_data.is_empty() { - os.write_bytes(3, &self.type_option_data)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FieldTypeOptionData { - FieldTypeOptionData::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &FieldTypeOptionData| { &m.grid_id }, - |m: &mut FieldTypeOptionData| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "field", - |m: &FieldTypeOptionData| { &m.field }, - |m: &mut FieldTypeOptionData| { &mut m.field }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "type_option_data", - |m: &FieldTypeOptionData| { &m.type_option_data }, - |m: &mut FieldTypeOptionData| { &mut m.type_option_data }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "FieldTypeOptionData", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static FieldTypeOptionData { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(FieldTypeOptionData::new) - } -} - -impl ::protobuf::Clear for FieldTypeOptionData { - fn clear(&mut self) { - self.grid_id.clear(); - self.field.clear(); - self.type_option_data.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FieldTypeOptionData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FieldTypeOptionData { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RepeatedField { - // message fields - pub items: ::protobuf::RepeatedField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a RepeatedField { - fn default() -> &'a RepeatedField { - ::default_instance() - } -} - -impl RepeatedField { - pub fn new() -> RepeatedField { - ::std::default::Default::default() - } - - // repeated .Field items = 1; - - - pub fn get_items(&self) -> &[Field] { - &self.items - } - pub fn clear_items(&mut self) { - self.items.clear(); - } - - // Param is passed by value, moved - pub fn set_items(&mut self, v: ::protobuf::RepeatedField) { - self.items = v; - } - - // Mutable pointer to the field. - pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.items - } - - // Take field - pub fn take_items(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) - } -} - -impl ::protobuf::Message for RepeatedField { - fn is_initialized(&self) -> bool { - for v in &self.items { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.items)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - for value in &self.items { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - for v in &self.items { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RepeatedField { - RepeatedField::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "items", - |m: &RepeatedField| { &m.items }, - |m: &mut RepeatedField| { &mut m.items }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "RepeatedField", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static RepeatedField { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(RepeatedField::new) - } -} - -impl ::protobuf::Clear for RepeatedField { - fn clear(&mut self) { - self.items.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RepeatedField { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RepeatedField { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RepeatedFieldOrder { - // message fields - pub items: ::protobuf::RepeatedField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a RepeatedFieldOrder { - fn default() -> &'a RepeatedFieldOrder { - ::default_instance() - } -} - -impl RepeatedFieldOrder { - pub fn new() -> RepeatedFieldOrder { - ::std::default::Default::default() - } - - // repeated .FieldOrder items = 1; - - - pub fn get_items(&self) -> &[FieldOrder] { - &self.items - } - pub fn clear_items(&mut self) { - self.items.clear(); - } - - // Param is passed by value, moved - pub fn set_items(&mut self, v: ::protobuf::RepeatedField) { - self.items = v; - } - - // Mutable pointer to the field. - pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.items - } - - // Take field - pub fn take_items(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) - } -} - -impl ::protobuf::Message for RepeatedFieldOrder { - fn is_initialized(&self) -> bool { - for v in &self.items { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.items)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - for value in &self.items { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - for v in &self.items { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RepeatedFieldOrder { - RepeatedFieldOrder::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "items", - |m: &RepeatedFieldOrder| { &m.items }, - |m: &mut RepeatedFieldOrder| { &mut m.items }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "RepeatedFieldOrder", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static RepeatedFieldOrder { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(RepeatedFieldOrder::new) - } -} - -impl ::protobuf::Clear for RepeatedFieldOrder { - fn clear(&mut self) { - self.items.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RepeatedFieldOrder { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RepeatedFieldOrder { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - #[derive(PartialEq,Clone,Default)] pub struct RowOrder { // message fields @@ -5824,805 +3349,6 @@ impl ::protobuf::reflect::ProtobufValue for CreateRowPayload { } } -#[derive(PartialEq,Clone,Default)] -pub struct InsertFieldPayload { - // message fields - pub grid_id: ::std::string::String, - pub field: ::protobuf::SingularPtrField, - pub type_option_data: ::std::vec::Vec, - // message oneof groups - pub one_of_start_field_id: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a InsertFieldPayload { - fn default() -> &'a InsertFieldPayload { - ::default_instance() - } -} - -#[derive(Clone,PartialEq,Debug)] -pub enum InsertFieldPayload_oneof_one_of_start_field_id { - start_field_id(::std::string::String), -} - -impl InsertFieldPayload { - pub fn new() -> InsertFieldPayload { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // .Field field = 2; - - - pub fn get_field(&self) -> &Field { - self.field.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_field(&mut self) { - self.field.clear(); - } - - pub fn has_field(&self) -> bool { - self.field.is_some() - } - - // Param is passed by value, moved - pub fn set_field(&mut self, v: Field) { - self.field = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field(&mut self) -> &mut Field { - if self.field.is_none() { - self.field.set_default(); - } - self.field.as_mut().unwrap() - } - - // Take field - pub fn take_field(&mut self) -> Field { - self.field.take().unwrap_or_else(|| Field::new()) - } - - // bytes type_option_data = 3; - - - pub fn get_type_option_data(&self) -> &[u8] { - &self.type_option_data - } - pub fn clear_type_option_data(&mut self) { - self.type_option_data.clear(); - } - - // Param is passed by value, moved - pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { - self.type_option_data = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { - &mut self.type_option_data - } - - // Take field - pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) - } - - // string start_field_id = 4; - - - pub fn get_start_field_id(&self) -> &str { - match self.one_of_start_field_id { - ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref v)) => v, - _ => "", - } - } - pub fn clear_start_field_id(&mut self) { - self.one_of_start_field_id = ::std::option::Option::None; - } - - pub fn has_start_field_id(&self) -> bool { - match self.one_of_start_field_id { - ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_start_field_id(&mut self, v: ::std::string::String) { - self.one_of_start_field_id = ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(v)) - } - - // Mutable pointer to the field. - pub fn mut_start_field_id(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(_)) = self.one_of_start_field_id { - } else { - self.one_of_start_field_id = ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(::std::string::String::new())); - } - match self.one_of_start_field_id { - ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_start_field_id(&mut self) -> ::std::string::String { - if self.has_start_field_id() { - match self.one_of_start_field_id.take() { - ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } -} - -impl ::protobuf::Message for InsertFieldPayload { - fn is_initialized(&self) -> bool { - for v in &self.field { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_start_field_id = ::std::option::Option::Some(InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(is.read_string()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - if let Some(ref v) = self.field.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.type_option_data.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); - } - if let ::std::option::Option::Some(ref v) = self.one_of_start_field_id { - match v { - &InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref v) => { - my_size += ::protobuf::rt::string_size(4, &v); - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - if let Some(ref v) = self.field.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.type_option_data.is_empty() { - os.write_bytes(3, &self.type_option_data)?; - } - if let ::std::option::Option::Some(ref v) = self.one_of_start_field_id { - match v { - &InsertFieldPayload_oneof_one_of_start_field_id::start_field_id(ref v) => { - os.write_string(4, v)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> InsertFieldPayload { - InsertFieldPayload::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &InsertFieldPayload| { &m.grid_id }, - |m: &mut InsertFieldPayload| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "field", - |m: &InsertFieldPayload| { &m.field }, - |m: &mut InsertFieldPayload| { &mut m.field }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "type_option_data", - |m: &InsertFieldPayload| { &m.type_option_data }, - |m: &mut InsertFieldPayload| { &mut m.type_option_data }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "start_field_id", - InsertFieldPayload::has_start_field_id, - InsertFieldPayload::get_start_field_id, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "InsertFieldPayload", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static InsertFieldPayload { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(InsertFieldPayload::new) - } -} - -impl ::protobuf::Clear for InsertFieldPayload { - fn clear(&mut self) { - self.grid_id.clear(); - self.field.clear(); - self.type_option_data.clear(); - self.one_of_start_field_id = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for InsertFieldPayload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for InsertFieldPayload { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct UpdateFieldTypeOptionPayload { - // message fields - pub grid_id: ::std::string::String, - pub field_id: ::std::string::String, - pub type_option_data: ::std::vec::Vec, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a UpdateFieldTypeOptionPayload { - fn default() -> &'a UpdateFieldTypeOptionPayload { - ::default_instance() - } -} - -impl UpdateFieldTypeOptionPayload { - pub fn new() -> UpdateFieldTypeOptionPayload { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // string field_id = 2; - - - pub fn get_field_id(&self) -> &str { - &self.field_id - } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); - } - - // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id - } - - // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) - } - - // bytes type_option_data = 3; - - - pub fn get_type_option_data(&self) -> &[u8] { - &self.type_option_data - } - pub fn clear_type_option_data(&mut self) { - self.type_option_data.clear(); - } - - // Param is passed by value, moved - pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { - self.type_option_data = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { - &mut self.type_option_data - } - - // Take field - pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.type_option_data, ::std::vec::Vec::new()) - } -} - -impl ::protobuf::Message for UpdateFieldTypeOptionPayload { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.type_option_data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.field_id); - } - if !self.type_option_data.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.type_option_data); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - if !self.field_id.is_empty() { - os.write_string(2, &self.field_id)?; - } - if !self.type_option_data.is_empty() { - os.write_bytes(3, &self.type_option_data)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> UpdateFieldTypeOptionPayload { - UpdateFieldTypeOptionPayload::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &UpdateFieldTypeOptionPayload| { &m.grid_id }, - |m: &mut UpdateFieldTypeOptionPayload| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &UpdateFieldTypeOptionPayload| { &m.field_id }, - |m: &mut UpdateFieldTypeOptionPayload| { &mut m.field_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "type_option_data", - |m: &UpdateFieldTypeOptionPayload| { &m.type_option_data }, - |m: &mut UpdateFieldTypeOptionPayload| { &mut m.type_option_data }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "UpdateFieldTypeOptionPayload", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static UpdateFieldTypeOptionPayload { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(UpdateFieldTypeOptionPayload::new) - } -} - -impl ::protobuf::Clear for UpdateFieldTypeOptionPayload { - fn clear(&mut self) { - self.grid_id.clear(); - self.field_id.clear(); - self.type_option_data.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for UpdateFieldTypeOptionPayload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for UpdateFieldTypeOptionPayload { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct QueryFieldPayload { - // message fields - pub grid_id: ::std::string::String, - pub field_orders: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a QueryFieldPayload { - fn default() -> &'a QueryFieldPayload { - ::default_instance() - } -} - -impl QueryFieldPayload { - pub fn new() -> QueryFieldPayload { - ::std::default::Default::default() - } - - // string grid_id = 1; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // .RepeatedFieldOrder field_orders = 2; - - - pub fn get_field_orders(&self) -> &RepeatedFieldOrder { - self.field_orders.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_field_orders(&mut self) { - self.field_orders.clear(); - } - - pub fn has_field_orders(&self) -> bool { - self.field_orders.is_some() - } - - // Param is passed by value, moved - pub fn set_field_orders(&mut self, v: RepeatedFieldOrder) { - self.field_orders = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_orders(&mut self) -> &mut RepeatedFieldOrder { - if self.field_orders.is_none() { - self.field_orders.set_default(); - } - self.field_orders.as_mut().unwrap() - } - - // Take field - pub fn take_field_orders(&mut self) -> RepeatedFieldOrder { - self.field_orders.take().unwrap_or_else(|| RepeatedFieldOrder::new()) - } -} - -impl ::protobuf::Message for QueryFieldPayload { - fn is_initialized(&self) -> bool { - for v in &self.field_orders { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.field_orders)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.grid_id); - } - if let Some(ref v) = self.field_orders.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.grid_id.is_empty() { - os.write_string(1, &self.grid_id)?; - } - if let Some(ref v) = self.field_orders.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> QueryFieldPayload { - QueryFieldPayload::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &QueryFieldPayload| { &m.grid_id }, - |m: &mut QueryFieldPayload| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "field_orders", - |m: &QueryFieldPayload| { &m.field_orders }, - |m: &mut QueryFieldPayload| { &mut m.field_orders }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "QueryFieldPayload", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static QueryFieldPayload { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(QueryFieldPayload::new) - } -} - -impl ::protobuf::Clear for QueryFieldPayload { - fn clear(&mut self) { - self.grid_id.clear(); - self.field_orders.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for QueryFieldPayload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for QueryFieldPayload { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - #[derive(PartialEq,Clone,Default)] pub struct QueryGridBlocksPayload { // message fields @@ -6831,679 +3557,6 @@ impl ::protobuf::reflect::ProtobufValue for QueryGridBlocksPayload { } } -#[derive(PartialEq,Clone,Default)] -pub struct FieldChangesetPayload { - // message fields - pub field_id: ::std::string::String, - pub grid_id: ::std::string::String, - // message oneof groups - pub one_of_name: ::std::option::Option, - pub one_of_desc: ::std::option::Option, - pub one_of_field_type: ::std::option::Option, - pub one_of_frozen: ::std::option::Option, - pub one_of_visibility: ::std::option::Option, - pub one_of_width: ::std::option::Option, - pub one_of_type_option_data: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a FieldChangesetPayload { - fn default() -> &'a FieldChangesetPayload { - ::default_instance() - } -} - -#[derive(Clone,PartialEq,Debug)] -pub enum FieldChangesetPayload_oneof_one_of_name { - name(::std::string::String), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum FieldChangesetPayload_oneof_one_of_desc { - desc(::std::string::String), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum FieldChangesetPayload_oneof_one_of_field_type { - field_type(FieldType), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum FieldChangesetPayload_oneof_one_of_frozen { - frozen(bool), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum FieldChangesetPayload_oneof_one_of_visibility { - visibility(bool), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum FieldChangesetPayload_oneof_one_of_width { - width(i32), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum FieldChangesetPayload_oneof_one_of_type_option_data { - type_option_data(::std::vec::Vec), -} - -impl FieldChangesetPayload { - pub fn new() -> FieldChangesetPayload { - ::std::default::Default::default() - } - - // string field_id = 1; - - - pub fn get_field_id(&self) -> &str { - &self.field_id - } - pub fn clear_field_id(&mut self) { - self.field_id.clear(); - } - - // Param is passed by value, moved - pub fn set_field_id(&mut self, v: ::std::string::String) { - self.field_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_id(&mut self) -> &mut ::std::string::String { - &mut self.field_id - } - - // Take field - pub fn take_field_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) - } - - // string grid_id = 2; - - - pub fn get_grid_id(&self) -> &str { - &self.grid_id - } - pub fn clear_grid_id(&mut self) { - self.grid_id.clear(); - } - - // Param is passed by value, moved - pub fn set_grid_id(&mut self, v: ::std::string::String) { - self.grid_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { - &mut self.grid_id - } - - // Take field - pub fn take_grid_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) - } - - // string name = 3; - - - pub fn get_name(&self) -> &str { - match self.one_of_name { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(ref v)) => v, - _ => "", - } - } - pub fn clear_name(&mut self) { - self.one_of_name = ::std::option::Option::None; - } - - pub fn has_name(&self) -> bool { - match self.one_of_name { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.one_of_name = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(v)) - } - - // Mutable pointer to the field. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(_)) = self.one_of_name { - } else { - self.one_of_name = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(::std::string::String::new())); - } - match self.one_of_name { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - if self.has_name() { - match self.one_of_name.take() { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } - - // string desc = 4; - - - pub fn get_desc(&self) -> &str { - match self.one_of_desc { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(ref v)) => v, - _ => "", - } - } - pub fn clear_desc(&mut self) { - self.one_of_desc = ::std::option::Option::None; - } - - pub fn has_desc(&self) -> bool { - match self.one_of_desc { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_desc(&mut self, v: ::std::string::String) { - self.one_of_desc = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(v)) - } - - // Mutable pointer to the field. - pub fn mut_desc(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(_)) = self.one_of_desc { - } else { - self.one_of_desc = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(::std::string::String::new())); - } - match self.one_of_desc { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_desc(&mut self) -> ::std::string::String { - if self.has_desc() { - match self.one_of_desc.take() { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } - - // .FieldType field_type = 5; - - - pub fn get_field_type(&self) -> FieldType { - match self.one_of_field_type { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(v)) => v, - _ => FieldType::RichText, - } - } - pub fn clear_field_type(&mut self) { - self.one_of_field_type = ::std::option::Option::None; - } - - pub fn has_field_type(&self) -> bool { - match self.one_of_field_type { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: FieldType) { - self.one_of_field_type = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(v)) - } - - // bool frozen = 6; - - - pub fn get_frozen(&self) -> bool { - match self.one_of_frozen { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(v)) => v, - _ => false, - } - } - pub fn clear_frozen(&mut self) { - self.one_of_frozen = ::std::option::Option::None; - } - - pub fn has_frozen(&self) -> bool { - match self.one_of_frozen { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_frozen(&mut self, v: bool) { - self.one_of_frozen = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(v)) - } - - // bool visibility = 7; - - - pub fn get_visibility(&self) -> bool { - match self.one_of_visibility { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(v)) => v, - _ => false, - } - } - pub fn clear_visibility(&mut self) { - self.one_of_visibility = ::std::option::Option::None; - } - - pub fn has_visibility(&self) -> bool { - match self.one_of_visibility { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_visibility(&mut self, v: bool) { - self.one_of_visibility = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(v)) - } - - // int32 width = 8; - - - pub fn get_width(&self) -> i32 { - match self.one_of_width { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(v)) => v, - _ => 0, - } - } - pub fn clear_width(&mut self) { - self.one_of_width = ::std::option::Option::None; - } - - pub fn has_width(&self) -> bool { - match self.one_of_width { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_width(&mut self, v: i32) { - self.one_of_width = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(v)) - } - - // bytes type_option_data = 9; - - - pub fn get_type_option_data(&self) -> &[u8] { - match self.one_of_type_option_data { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref v)) => v, - _ => &[], - } - } - pub fn clear_type_option_data(&mut self) { - self.one_of_type_option_data = ::std::option::Option::None; - } - - pub fn has_type_option_data(&self) -> bool { - match self.one_of_type_option_data { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_type_option_data(&mut self, v: ::std::vec::Vec) { - self.one_of_type_option_data = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(v)) - } - - // Mutable pointer to the field. - pub fn mut_type_option_data(&mut self) -> &mut ::std::vec::Vec { - if let ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(_)) = self.one_of_type_option_data { - } else { - self.one_of_type_option_data = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(::std::vec::Vec::new())); - } - match self.one_of_type_option_data { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_type_option_data(&mut self) -> ::std::vec::Vec { - if self.has_type_option_data() { - match self.one_of_type_option_data.take() { - ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(v)) => v, - _ => panic!(), - } - } else { - ::std::vec::Vec::new() - } - } -} - -impl ::protobuf::Message for FieldChangesetPayload { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_name = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_name::name(is.read_string()?)); - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_desc = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_desc::desc(is.read_string()?)); - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_field_type = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_field_type::field_type(is.read_enum()?)); - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_frozen = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_frozen::frozen(is.read_bool()?)); - }, - 7 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_visibility = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_visibility::visibility(is.read_bool()?)); - }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_width = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_width::width(is.read_int32()?)); - }, - 9 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_type_option_data = ::std::option::Option::Some(FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(is.read_bytes()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.field_id); - } - if !self.grid_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.grid_id); - } - if let ::std::option::Option::Some(ref v) = self.one_of_name { - match v { - &FieldChangesetPayload_oneof_one_of_name::name(ref v) => { - my_size += ::protobuf::rt::string_size(3, &v); - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_desc { - match v { - &FieldChangesetPayload_oneof_one_of_desc::desc(ref v) => { - my_size += ::protobuf::rt::string_size(4, &v); - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_field_type { - match v { - &FieldChangesetPayload_oneof_one_of_field_type::field_type(v) => { - my_size += ::protobuf::rt::enum_size(5, v); - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_frozen { - match v { - &FieldChangesetPayload_oneof_one_of_frozen::frozen(v) => { - my_size += 2; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_visibility { - match v { - &FieldChangesetPayload_oneof_one_of_visibility::visibility(v) => { - my_size += 2; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_width { - match v { - &FieldChangesetPayload_oneof_one_of_width::width(v) => { - my_size += ::protobuf::rt::value_size(8, v, ::protobuf::wire_format::WireTypeVarint); - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_type_option_data { - match v { - &FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref v) => { - my_size += ::protobuf::rt::bytes_size(9, &v); - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.field_id.is_empty() { - os.write_string(1, &self.field_id)?; - } - if !self.grid_id.is_empty() { - os.write_string(2, &self.grid_id)?; - } - if let ::std::option::Option::Some(ref v) = self.one_of_name { - match v { - &FieldChangesetPayload_oneof_one_of_name::name(ref v) => { - os.write_string(3, v)?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_desc { - match v { - &FieldChangesetPayload_oneof_one_of_desc::desc(ref v) => { - os.write_string(4, v)?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_field_type { - match v { - &FieldChangesetPayload_oneof_one_of_field_type::field_type(v) => { - os.write_enum(5, ::protobuf::ProtobufEnum::value(&v))?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_frozen { - match v { - &FieldChangesetPayload_oneof_one_of_frozen::frozen(v) => { - os.write_bool(6, v)?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_visibility { - match v { - &FieldChangesetPayload_oneof_one_of_visibility::visibility(v) => { - os.write_bool(7, v)?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_width { - match v { - &FieldChangesetPayload_oneof_one_of_width::width(v) => { - os.write_int32(8, v)?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_type_option_data { - match v { - &FieldChangesetPayload_oneof_one_of_type_option_data::type_option_data(ref v) => { - os.write_bytes(9, v)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FieldChangesetPayload { - FieldChangesetPayload::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &FieldChangesetPayload| { &m.field_id }, - |m: &mut FieldChangesetPayload| { &mut m.field_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "grid_id", - |m: &FieldChangesetPayload| { &m.grid_id }, - |m: &mut FieldChangesetPayload| { &mut m.grid_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "name", - FieldChangesetPayload::has_name, - FieldChangesetPayload::get_name, - )); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "desc", - FieldChangesetPayload::has_desc, - FieldChangesetPayload::get_desc, - )); - fields.push(::protobuf::reflect::accessor::make_singular_enum_accessor::<_, FieldType>( - "field_type", - FieldChangesetPayload::has_field_type, - FieldChangesetPayload::get_field_type, - )); - fields.push(::protobuf::reflect::accessor::make_singular_bool_accessor::<_>( - "frozen", - FieldChangesetPayload::has_frozen, - FieldChangesetPayload::get_frozen, - )); - fields.push(::protobuf::reflect::accessor::make_singular_bool_accessor::<_>( - "visibility", - FieldChangesetPayload::has_visibility, - FieldChangesetPayload::get_visibility, - )); - fields.push(::protobuf::reflect::accessor::make_singular_i32_accessor::<_>( - "width", - FieldChangesetPayload::has_width, - FieldChangesetPayload::get_width, - )); - fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>( - "type_option_data", - FieldChangesetPayload::has_type_option_data, - FieldChangesetPayload::get_type_option_data, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "FieldChangesetPayload", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static FieldChangesetPayload { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(FieldChangesetPayload::new) - } -} - -impl ::protobuf::Clear for FieldChangesetPayload { - fn clear(&mut self) { - self.field_id.clear(); - self.grid_id.clear(); - self.one_of_name = ::std::option::Option::None; - self.one_of_desc = ::std::option::Option::None; - self.one_of_field_type = ::std::option::Option::None; - self.one_of_frozen = ::std::option::Option::None; - self.one_of_visibility = ::std::option::Option::None; - self.one_of_width = ::std::option::Option::None; - self.one_of_type_option_data = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FieldChangesetPayload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FieldChangesetPayload { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - #[derive(PartialEq,Clone,Default)] pub struct MoveItemPayload { // message fields @@ -8181,169 +4234,53 @@ impl ::protobuf::reflect::ProtobufValue for MoveItemType { } } -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum FieldType { - RichText = 0, - Number = 1, - DateTime = 2, - SingleSelect = 3, - MultiSelect = 4, - Checkbox = 5, - URL = 6, -} - -impl ::protobuf::ProtobufEnum for FieldType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(FieldType::RichText), - 1 => ::std::option::Option::Some(FieldType::Number), - 2 => ::std::option::Option::Some(FieldType::DateTime), - 3 => ::std::option::Option::Some(FieldType::SingleSelect), - 4 => ::std::option::Option::Some(FieldType::MultiSelect), - 5 => ::std::option::Option::Some(FieldType::Checkbox), - 6 => ::std::option::Option::Some(FieldType::URL), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [FieldType] = &[ - FieldType::RichText, - FieldType::Number, - FieldType::DateTime, - FieldType::SingleSelect, - FieldType::MultiSelect, - FieldType::Checkbox, - FieldType::URL, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new_pb_name::("FieldType", file_descriptor_proto()) - }) - } -} - -impl ::std::marker::Copy for FieldType { -} - -impl ::std::default::Default for FieldType { - fn default() -> Self { - FieldType::RichText - } -} - -impl ::protobuf::reflect::ProtobufValue for FieldType { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) - } -} - static file_descriptor_proto_data: &'static [u8] = b"\ - \n\ngrid.proto\"z\n\x04Grid\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\ - \x12.\n\x0cfield_orders\x18\x02\x20\x03(\x0b2\x0b.FieldOrderR\x0bfieldOr\ - ders\x122\n\x0cblock_orders\x18\x03\x20\x03(\x0b2\x0f.GridBlockOrderR\ - \x0bblockOrders\"\xd7\x01\n\x05Field\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\ - \x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\ - \x18\x03\x20\x01(\tR\x04desc\x12)\n\nfield_type\x18\x04\x20\x01(\x0e2\n.\ - FieldTypeR\tfieldType\x12\x16\n\x06frozen\x18\x05\x20\x01(\x08R\x06froze\ - n\x12\x1e\n\nvisibility\x18\x06\x20\x01(\x08R\nvisibility\x12\x14\n\x05w\ - idth\x18\x07\x20\x01(\x05R\x05width\x12\x1d\n\nis_primary\x18\x08\x20\ - \x01(\x08R\tisPrimary\"'\n\nFieldOrder\x12\x19\n\x08field_id\x18\x01\x20\ - \x01(\tR\x07fieldId\"\xc6\x01\n\x12GridFieldChangeset\x12\x17\n\x07grid_\ - id\x18\x01\x20\x01(\tR\x06gridId\x124\n\x0finserted_fields\x18\x02\x20\ - \x03(\x0b2\x0b.IndexFieldR\x0einsertedFields\x122\n\x0edeleted_fields\ - \x18\x03\x20\x03(\x0b2\x0b.FieldOrderR\rdeletedFields\x12-\n\x0eupdated_\ - fields\x18\x04\x20\x03(\x0b2\x06.FieldR\rupdatedFields\"@\n\nIndexField\ - \x12\x1c\n\x05field\x18\x01\x20\x01(\x0b2\x06.FieldR\x05field\x12\x14\n\ - \x05index\x18\x02\x20\x01(\x05R\x05index\"\x90\x01\n\x1aGetEditFieldCont\ - extPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\x1b\n\ - \x08field_id\x18\x02\x20\x01(\tH\0R\x07fieldId\x12)\n\nfield_type\x18\ - \x03\x20\x01(\x0e2\n.FieldTypeR\tfieldTypeB\x11\n\x0fone_of_field_id\"\ - \xa0\x01\n\x10EditFieldPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\ - \x06gridId\x12\x19\n\x08field_id\x18\x02\x20\x01(\tR\x07fieldId\x12)\n\n\ - field_type\x18\x03\x20\x01(\x0e2\n.FieldTypeR\tfieldType\x12-\n\x13creat\ - e_if_not_exist\x18\x04\x20\x01(\x08R\x10createIfNotExist\"\x82\x01\n\x16\ - FieldTypeOptionContext\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridI\ - d\x12%\n\ngrid_field\x18\x02\x20\x01(\x0b2\x06.FieldR\tgridField\x12(\n\ - \x10type_option_data\x18\x03\x20\x01(\x0cR\x0etypeOptionData\"v\n\x13Fie\ - ldTypeOptionData\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\ - \x1c\n\x05field\x18\x02\x20\x01(\x0b2\x06.FieldR\x05field\x12(\n\x10type\ - _option_data\x18\x03\x20\x01(\x0cR\x0etypeOptionData\"-\n\rRepeatedField\ - \x12\x1c\n\x05items\x18\x01\x20\x03(\x0b2\x06.FieldR\x05items\"7\n\x12Re\ - peatedFieldOrder\x12!\n\x05items\x18\x01\x20\x03(\x0b2\x0b.FieldOrderR\ - \x05items\"T\n\x08RowOrder\x12\x15\n\x06row_id\x18\x01\x20\x01(\tR\x05ro\ - wId\x12\x19\n\x08block_id\x18\x02\x20\x01(\tR\x07blockId\x12\x16\n\x06he\ - ight\x18\x03\x20\x01(\x05R\x06height\"\xb8\x01\n\x03Row\x12\x0e\n\x02id\ - \x18\x01\x20\x01(\tR\x02id\x12@\n\x10cell_by_field_id\x18\x02\x20\x03(\ - \x0b2\x17.Row.CellByFieldIdEntryR\rcellByFieldId\x12\x16\n\x06height\x18\ - \x03\x20\x01(\x05R\x06height\x1aG\n\x12CellByFieldIdEntry\x12\x10\n\x03k\ - ey\x18\x01\x20\x01(\tR\x03key\x12\x1b\n\x05value\x18\x02\x20\x01(\x0b2\ - \x05.CellR\x05value:\x028\x01\")\n\x0bRepeatedRow\x12\x1a\n\x05items\x18\ - \x01\x20\x03(\x0b2\x04.RowR\x05items\"5\n\x11RepeatedGridBlock\x12\x20\n\ - \x05items\x18\x01\x20\x03(\x0b2\n.GridBlockR\x05items\"U\n\x0eGridBlockO\ - rder\x12\x19\n\x08block_id\x18\x01\x20\x01(\tR\x07blockId\x12(\n\nrow_or\ - ders\x18\x02\x20\x03(\x0b2\t.RowOrderR\trowOrders\"_\n\rIndexRowOrder\ - \x12&\n\trow_order\x18\x01\x20\x01(\x0b2\t.RowOrderR\x08rowOrder\x12\x16\ - \n\x05index\x18\x02\x20\x01(\x05H\0R\x05indexB\x0e\n\x0cone_of_index\"Q\ - \n\x0fUpdatedRowOrder\x12&\n\trow_order\x18\x01\x20\x01(\x0b2\t.RowOrder\ - R\x08rowOrder\x12\x16\n\x03row\x18\x02\x20\x01(\x0b2\x04.RowR\x03row\"\ - \xc6\x01\n\x11GridRowsChangeset\x12\x19\n\x08block_id\x18\x01\x20\x01(\t\ - R\x07blockId\x123\n\rinserted_rows\x18\x02\x20\x03(\x0b2\x0e.IndexRowOrd\ - erR\x0cinsertedRows\x12,\n\x0cdeleted_rows\x18\x03\x20\x03(\x0b2\t.RowOr\ - derR\x0bdeletedRows\x123\n\x0cupdated_rows\x18\x04\x20\x03(\x0b2\x10.Upd\ - atedRowOrderR\x0bupdatedRows\"E\n\tGridBlock\x12\x0e\n\x02id\x18\x01\x20\ - \x01(\tR\x02id\x12(\n\nrow_orders\x18\x02\x20\x03(\x0b2\t.RowOrderR\trow\ - Orders\"5\n\x04Cell\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\ - \x12\x12\n\x04data\x18\x02\x20\x01(\x0cR\x04data\"+\n\x0cRepeatedCell\ - \x12\x1b\n\x05items\x18\x01\x20\x03(\x0b2\x05.CellR\x05items\"'\n\x11Cre\ - ateGridPayload\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\"\x1e\n\x06\ - GridId\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value\"#\n\x0bGridBlock\ - Id\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value\"f\n\x10CreateRowPayl\ - oad\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\"\n\x0cstart_\ - row_id\x18\x02\x20\x01(\tH\0R\nstartRowIdB\x15\n\x13one_of_start_row_id\ - \"\xb6\x01\n\x12InsertFieldPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\ - \tR\x06gridId\x12\x1c\n\x05field\x18\x02\x20\x01(\x0b2\x06.FieldR\x05fie\ - ld\x12(\n\x10type_option_data\x18\x03\x20\x01(\x0cR\x0etypeOptionData\ - \x12&\n\x0estart_field_id\x18\x04\x20\x01(\tH\0R\x0cstartFieldIdB\x17\n\ - \x15one_of_start_field_id\"|\n\x1cUpdateFieldTypeOptionPayload\x12\x17\n\ - \x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\x19\n\x08field_id\x18\x02\ - \x20\x01(\tR\x07fieldId\x12(\n\x10type_option_data\x18\x03\x20\x01(\x0cR\ - \x0etypeOptionData\"d\n\x11QueryFieldPayload\x12\x17\n\x07grid_id\x18\ - \x01\x20\x01(\tR\x06gridId\x126\n\x0cfield_orders\x18\x02\x20\x01(\x0b2\ - \x13.RepeatedFieldOrderR\x0bfieldOrders\"e\n\x16QueryGridBlocksPayload\ - \x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x122\n\x0cblock_orde\ - rs\x18\x02\x20\x03(\x0b2\x0f.GridBlockOrderR\x0bblockOrders\"\xa8\x03\n\ - \x15FieldChangesetPayload\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07f\ - ieldId\x12\x17\n\x07grid_id\x18\x02\x20\x01(\tR\x06gridId\x12\x14\n\x04n\ - ame\x18\x03\x20\x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\x04\x20\x01(\tH\ - \x01R\x04desc\x12+\n\nfield_type\x18\x05\x20\x01(\x0e2\n.FieldTypeH\x02R\ - \tfieldType\x12\x18\n\x06frozen\x18\x06\x20\x01(\x08H\x03R\x06frozen\x12\ - \x20\n\nvisibility\x18\x07\x20\x01(\x08H\x04R\nvisibility\x12\x16\n\x05w\ - idth\x18\x08\x20\x01(\x05H\x05R\x05width\x12*\n\x10type_option_data\x18\ - \t\x20\x01(\x0cH\x06R\x0etypeOptionDataB\r\n\x0bone_of_nameB\r\n\x0bone_\ - of_descB\x13\n\x11one_of_field_typeB\x0f\n\rone_of_frozenB\x13\n\x11one_\ - of_visibilityB\x0e\n\x0cone_of_widthB\x19\n\x17one_of_type_option_data\"\ - \x9c\x01\n\x0fMoveItemPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\ - \x06gridId\x12\x17\n\x07item_id\x18\x02\x20\x01(\tR\x06itemId\x12\x1d\n\ - \nfrom_index\x18\x03\x20\x01(\x05R\tfromIndex\x12\x19\n\x08to_index\x18\ - \x04\x20\x01(\x05R\x07toIndex\x12\x1d\n\x02ty\x18\x05\x20\x01(\x0e2\r.Mo\ - veItemTypeR\x02ty\"\xb3\x01\n\rCellChangeset\x12\x17\n\x07grid_id\x18\ - \x01\x20\x01(\tR\x06gridId\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\x05ro\ - wId\x12\x19\n\x08field_id\x18\x03\x20\x01(\tR\x07fieldId\x126\n\x16cell_\ - content_changeset\x18\x04\x20\x01(\tH\0R\x14cellContentChangesetB\x1f\n\ - \x1done_of_cell_content_changeset**\n\x0cMoveItemType\x12\r\n\tMoveField\ - \x10\0\x12\x0b\n\x07MoveRow\x10\x01*m\n\tFieldType\x12\x0c\n\x08RichText\ - \x10\0\x12\n\n\x06Number\x10\x01\x12\x0c\n\x08DateTime\x10\x02\x12\x10\n\ - \x0cSingleSelect\x10\x03\x12\x0f\n\x0bMultiSelect\x10\x04\x12\x0c\n\x08C\ - heckbox\x10\x05\x12\x07\n\x03URL\x10\x06b\x06proto3\ + \n\ngrid.proto\x1a\x0bfield.proto\"z\n\x04Grid\x12\x0e\n\x02id\x18\x01\ + \x20\x01(\tR\x02id\x12.\n\x0cfield_orders\x18\x02\x20\x03(\x0b2\x0b.Fiel\ + dOrderR\x0bfieldOrders\x122\n\x0cblock_orders\x18\x03\x20\x03(\x0b2\x0f.\ + GridBlockOrderR\x0bblockOrders\"T\n\x08RowOrder\x12\x15\n\x06row_id\x18\ + \x01\x20\x01(\tR\x05rowId\x12\x19\n\x08block_id\x18\x02\x20\x01(\tR\x07b\ + lockId\x12\x16\n\x06height\x18\x03\x20\x01(\x05R\x06height\"\xb8\x01\n\ + \x03Row\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12@\n\x10cell_by_fiel\ + d_id\x18\x02\x20\x03(\x0b2\x17.Row.CellByFieldIdEntryR\rcellByFieldId\ + \x12\x16\n\x06height\x18\x03\x20\x01(\x05R\x06height\x1aG\n\x12CellByFie\ + ldIdEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x1b\n\x05value\ + \x18\x02\x20\x01(\x0b2\x05.CellR\x05value:\x028\x01\")\n\x0bRepeatedRow\ + \x12\x1a\n\x05items\x18\x01\x20\x03(\x0b2\x04.RowR\x05items\"5\n\x11Repe\ + atedGridBlock\x12\x20\n\x05items\x18\x01\x20\x03(\x0b2\n.GridBlockR\x05i\ + tems\"U\n\x0eGridBlockOrder\x12\x19\n\x08block_id\x18\x01\x20\x01(\tR\ + \x07blockId\x12(\n\nrow_orders\x18\x02\x20\x03(\x0b2\t.RowOrderR\trowOrd\ + ers\"_\n\rIndexRowOrder\x12&\n\trow_order\x18\x01\x20\x01(\x0b2\t.RowOrd\ + erR\x08rowOrder\x12\x16\n\x05index\x18\x02\x20\x01(\x05H\0R\x05indexB\ + \x0e\n\x0cone_of_index\"Q\n\x0fUpdatedRowOrder\x12&\n\trow_order\x18\x01\ + \x20\x01(\x0b2\t.RowOrderR\x08rowOrder\x12\x16\n\x03row\x18\x02\x20\x01(\ + \x0b2\x04.RowR\x03row\"\xc6\x01\n\x11GridRowsChangeset\x12\x19\n\x08bloc\ + k_id\x18\x01\x20\x01(\tR\x07blockId\x123\n\rinserted_rows\x18\x02\x20\ + \x03(\x0b2\x0e.IndexRowOrderR\x0cinsertedRows\x12,\n\x0cdeleted_rows\x18\ + \x03\x20\x03(\x0b2\t.RowOrderR\x0bdeletedRows\x123\n\x0cupdated_rows\x18\ + \x04\x20\x03(\x0b2\x10.UpdatedRowOrderR\x0bupdatedRows\"E\n\tGridBlock\ + \x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12(\n\nrow_orders\x18\x02\ + \x20\x03(\x0b2\t.RowOrderR\trowOrders\"5\n\x04Cell\x12\x19\n\x08field_id\ + \x18\x01\x20\x01(\tR\x07fieldId\x12\x12\n\x04data\x18\x02\x20\x01(\x0cR\ + \x04data\"+\n\x0cRepeatedCell\x12\x1b\n\x05items\x18\x01\x20\x03(\x0b2\ + \x05.CellR\x05items\"'\n\x11CreateGridPayload\x12\x12\n\x04name\x18\x01\ + \x20\x01(\tR\x04name\"\x1e\n\x06GridId\x12\x14\n\x05value\x18\x01\x20\ + \x01(\tR\x05value\"#\n\x0bGridBlockId\x12\x14\n\x05value\x18\x01\x20\x01\ + (\tR\x05value\"f\n\x10CreateRowPayload\x12\x17\n\x07grid_id\x18\x01\x20\ + \x01(\tR\x06gridId\x12\"\n\x0cstart_row_id\x18\x02\x20\x01(\tH\0R\nstart\ + RowIdB\x15\n\x13one_of_start_row_id\"e\n\x16QueryGridBlocksPayload\x12\ + \x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x122\n\x0cblock_orders\ + \x18\x02\x20\x03(\x0b2\x0f.GridBlockOrderR\x0bblockOrders\"\x9c\x01\n\ + \x0fMoveItemPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\ + \x12\x17\n\x07item_id\x18\x02\x20\x01(\tR\x06itemId\x12\x1d\n\nfrom_inde\ + x\x18\x03\x20\x01(\x05R\tfromIndex\x12\x19\n\x08to_index\x18\x04\x20\x01\ + (\x05R\x07toIndex\x12\x1d\n\x02ty\x18\x05\x20\x01(\x0e2\r.MoveItemTypeR\ + \x02ty\"\xb3\x01\n\rCellChangeset\x12\x17\n\x07grid_id\x18\x01\x20\x01(\ + \tR\x06gridId\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\x05rowId\x12\x19\n\ + \x08field_id\x18\x03\x20\x01(\tR\x07fieldId\x126\n\x16cell_content_chang\ + eset\x18\x04\x20\x01(\tH\0R\x14cellContentChangesetB\x1f\n\x1done_of_cel\ + l_content_changeset**\n\x0cMoveItemType\x12\r\n\tMoveField\x10\0\x12\x0b\ + \n\x07MoveRow\x10\x01b\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs b/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs index 7b56c6cee8..d066a6e3d8 100644 --- a/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs +++ b/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs @@ -3,3 +3,6 @@ mod grid; pub use grid::*; + +mod field; +pub use field::*; diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/proto/field.proto b/shared-lib/flowy-grid-data-model/src/protobuf/proto/field.proto new file mode 100644 index 0000000000..7ec7559110 --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/protobuf/proto/field.proto @@ -0,0 +1,87 @@ +syntax = "proto3"; + +message Field { + string id = 1; + string name = 2; + string desc = 3; + FieldType field_type = 4; + bool frozen = 5; + bool visibility = 6; + int32 width = 7; + bool is_primary = 8; +} +message FieldOrder { + string field_id = 1; +} +message GridFieldChangeset { + string grid_id = 1; + repeated IndexField inserted_fields = 2; + repeated FieldOrder deleted_fields = 3; + repeated Field updated_fields = 4; +} +message IndexField { + Field field = 1; + int32 index = 2; +} +message GetEditFieldContextPayload { + string grid_id = 1; + oneof one_of_field_id { string field_id = 2; }; + FieldType field_type = 3; +} +message EditFieldPayload { + string grid_id = 1; + string field_id = 2; + FieldType field_type = 3; + bool create_if_not_exist = 4; +} +message FieldTypeOptionContext { + string grid_id = 1; + Field grid_field = 2; + bytes type_option_data = 3; +} +message FieldTypeOptionData { + string grid_id = 1; + Field field = 2; + bytes type_option_data = 3; +} +message RepeatedField { + repeated Field items = 1; +} +message RepeatedFieldOrder { + repeated FieldOrder items = 1; +} +message InsertFieldPayload { + string grid_id = 1; + Field field = 2; + bytes type_option_data = 3; + oneof one_of_start_field_id { string start_field_id = 4; }; +} +message UpdateFieldTypeOptionPayload { + string grid_id = 1; + string field_id = 2; + bytes type_option_data = 3; +} +message QueryFieldPayload { + string grid_id = 1; + RepeatedFieldOrder field_orders = 2; +} +message FieldChangesetPayload { + string field_id = 1; + string grid_id = 2; + oneof one_of_name { string name = 3; }; + oneof one_of_desc { string desc = 4; }; + oneof one_of_field_type { FieldType field_type = 5; }; + oneof one_of_frozen { bool frozen = 6; }; + oneof one_of_visibility { bool visibility = 7; }; + oneof one_of_width { int32 width = 8; }; + oneof one_of_type_option_data { bytes type_option_data = 9; }; +} +enum FieldType { + RichText = 0; + Number = 1; + DateTime = 2; + SingleSelect = 3; + MultiSelect = 4; + Checkbox = 5; + URL = 6; +} diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto b/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto index f06d84e5b8..1a99f272f6 100644 --- a/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto +++ b/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto @@ -1,60 +1,11 @@ syntax = "proto3"; +import "field.proto"; message Grid { string id = 1; repeated FieldOrder field_orders = 2; repeated GridBlockOrder block_orders = 3; } -message Field { - string id = 1; - string name = 2; - string desc = 3; - FieldType field_type = 4; - bool frozen = 5; - bool visibility = 6; - int32 width = 7; - bool is_primary = 8; -} -message FieldOrder { - string field_id = 1; -} -message GridFieldChangeset { - string grid_id = 1; - repeated IndexField inserted_fields = 2; - repeated FieldOrder deleted_fields = 3; - repeated Field updated_fields = 4; -} -message IndexField { - Field field = 1; - int32 index = 2; -} -message GetEditFieldContextPayload { - string grid_id = 1; - oneof one_of_field_id { string field_id = 2; }; - FieldType field_type = 3; -} -message EditFieldPayload { - string grid_id = 1; - string field_id = 2; - FieldType field_type = 3; - bool create_if_not_exist = 4; -} -message FieldTypeOptionContext { - string grid_id = 1; - Field grid_field = 2; - bytes type_option_data = 3; -} -message FieldTypeOptionData { - string grid_id = 1; - Field field = 2; - bytes type_option_data = 3; -} -message RepeatedField { - repeated Field items = 1; -} -message RepeatedFieldOrder { - repeated FieldOrder items = 1; -} message RowOrder { string row_id = 1; string block_id = 2; @@ -113,36 +64,10 @@ message CreateRowPayload { string grid_id = 1; oneof one_of_start_row_id { string start_row_id = 2; }; } -message InsertFieldPayload { - string grid_id = 1; - Field field = 2; - bytes type_option_data = 3; - oneof one_of_start_field_id { string start_field_id = 4; }; -} -message UpdateFieldTypeOptionPayload { - string grid_id = 1; - string field_id = 2; - bytes type_option_data = 3; -} -message QueryFieldPayload { - string grid_id = 1; - RepeatedFieldOrder field_orders = 2; -} message QueryGridBlocksPayload { string grid_id = 1; repeated GridBlockOrder block_orders = 2; } -message FieldChangesetPayload { - string field_id = 1; - string grid_id = 2; - oneof one_of_name { string name = 3; }; - oneof one_of_desc { string desc = 4; }; - oneof one_of_field_type { FieldType field_type = 5; }; - oneof one_of_frozen { bool frozen = 6; }; - oneof one_of_visibility { bool visibility = 7; }; - oneof one_of_width { int32 width = 8; }; - oneof one_of_type_option_data { bytes type_option_data = 9; }; -} message MoveItemPayload { string grid_id = 1; string item_id = 2; @@ -160,12 +85,3 @@ enum MoveItemType { MoveField = 0; MoveRow = 1; } -enum FieldType { - RichText = 0; - Number = 1; - DateTime = 2; - SingleSelect = 3; - MultiSelect = 4; - Checkbox = 5; - URL = 6; -} diff --git a/shared-lib/flowy-grid-data-model/src/entities/meta.rs b/shared-lib/flowy-grid-data-model/src/revision/mod.rs similarity index 66% rename from shared-lib/flowy-grid-data-model/src/entities/meta.rs rename to shared-lib/flowy-grid-data-model/src/revision/mod.rs index d62965245b..a667d3c587 100644 --- a/shared-lib/flowy-grid-data-model/src/entities/meta.rs +++ b/shared-lib/flowy-grid-data-model/src/revision/mod.rs @@ -1,9 +1,11 @@ -use crate::entities::FieldType; +use crate::entities::{CellChangeset, Field, FieldOrder, FieldType, RowOrder}; use bytes::Bytes; use indexmap::IndexMap; use nanoid::nanoid; use serde::{Deserialize, Serialize}; +use std::any::Any; use std::collections::HashMap; +use std::sync::Arc; pub const DEFAULT_ROW_HEIGHT: i32 = 42; @@ -25,20 +27,20 @@ pub fn gen_field_id() -> String { } #[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct GridMeta { +pub struct GridRevision { pub grid_id: String, - pub fields: Vec, - pub blocks: Vec, + pub fields: Vec, + pub blocks: Vec, } #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub struct GridBlockMeta { +pub struct GridBlockRevision { pub block_id: String, pub start_row_index: i32, pub row_count: i32, } -impl GridBlockMeta { +impl GridBlockRevision { pub fn len(&self) -> i32 { self.row_count } @@ -48,22 +50,22 @@ impl GridBlockMeta { } } -impl GridBlockMeta { +impl GridBlockRevision { pub fn new() -> Self { - GridBlockMeta { + GridBlockRevision { block_id: gen_block_id(), ..Default::default() } } } -pub struct GridBlockMetaChangeset { +pub struct GridBlockRevisionChangeset { pub block_id: String, pub start_row_index: Option, pub row_count: Option, } -impl GridBlockMetaChangeset { +impl GridBlockRevisionChangeset { pub fn from_row_count(block_id: &str, row_count: i32) -> Self { Self { block_id: block_id.to_string(), @@ -74,13 +76,13 @@ impl GridBlockMetaChangeset { } #[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct GridBlockMetaData { +pub struct GridBlockRevisionData { pub block_id: String, - pub rows: Vec, + pub rows: Vec, } #[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq)] -pub struct FieldMeta { +pub struct FieldRevision { pub id: String, pub name: String, @@ -110,7 +112,7 @@ fn default_is_primary() -> bool { false } -impl FieldMeta { +impl FieldRevision { pub fn new(name: &str, desc: &str, field_type: FieldType, is_primary: bool) -> Self { let width = field_type.default_cell_width(); Self { @@ -148,6 +150,29 @@ impl FieldMeta { } } +impl std::convert::From for Field { + fn from(field_rev: FieldRevision) -> Self { + Self { + id: field_rev.id, + name: field_rev.name, + desc: field_rev.desc, + field_type: field_rev.field_type, + frozen: field_rev.frozen, + visibility: field_rev.visibility, + width: field_rev.width, + is_primary: field_rev.is_primary, + } + } +} + +impl std::convert::From<&FieldRevision> for FieldOrder { + fn from(field_rev: &FieldRevision) -> Self { + Self { + field_id: field_rev.id.clone(), + } + } +} + pub trait TypeOptionDataEntry { fn field_type(&self) -> FieldType; fn json_str(&self) -> String; @@ -160,19 +185,19 @@ pub trait TypeOptionDataDeserializer { } #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub struct RowMeta { +pub struct RowRevision { pub id: String, pub block_id: String, /// cells contains key/value pairs. /// key: field id, /// value: CellMeta #[serde(with = "indexmap::serde_seq")] - pub cells: IndexMap, + pub cells: IndexMap, pub height: i32, pub visibility: bool, } -impl RowMeta { +impl RowRevision { pub fn new(block_id: &str) -> Self { Self { id: gen_row_id(), @@ -184,20 +209,58 @@ impl RowMeta { } } +impl std::convert::From<&RowRevision> for RowOrder { + fn from(row: &RowRevision) -> Self { + Self { + row_id: row.id.clone(), + block_id: row.block_id.clone(), + height: row.height, + } + } +} + +impl std::convert::From<&Arc> for RowOrder { + fn from(row: &Arc) -> Self { + Self { + row_id: row.id.clone(), + block_id: row.block_id.clone(), + height: row.height, + } + } +} + #[derive(Debug, Clone, Default)] pub struct RowMetaChangeset { pub row_id: String, pub height: Option, pub visibility: Option, - pub cell_by_field_id: HashMap, + pub cell_by_field_id: HashMap, +} + +impl std::convert::From for RowMetaChangeset { + fn from(changeset: CellChangeset) -> Self { + let mut cell_by_field_id = HashMap::with_capacity(1); + let field_id = changeset.field_id; + let cell_rev = CellRevision { + data: changeset.cell_content_changeset.unwrap_or_else(|| "".to_owned()), + }; + cell_by_field_id.insert(field_id, cell_rev); + + RowMetaChangeset { + row_id: changeset.row_id, + height: None, + visibility: None, + cell_by_field_id, + } + } } #[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] -pub struct CellMeta { +pub struct CellRevision { pub data: String, } -impl CellMeta { +impl CellRevision { pub fn new(data: String) -> Self { Self { data } } @@ -205,9 +268,9 @@ impl CellMeta { #[derive(Clone, Default, Deserialize, Serialize)] pub struct BuildGridContext { - pub field_metas: Vec, - pub blocks: Vec, - pub blocks_meta_data: Vec, + pub field_revs: Vec, + pub blocks: Vec, + pub blocks_meta_data: Vec, } impl BuildGridContext { diff --git a/shared-lib/flowy-grid-data-model/tests/serde_test.rs b/shared-lib/flowy-grid-data-model/tests/serde_test.rs index 22d4b92a6d..62e5b13197 100644 --- a/shared-lib/flowy-grid-data-model/tests/serde_test.rs +++ b/shared-lib/flowy-grid-data-model/tests/serde_test.rs @@ -1,9 +1,9 @@ -use flowy_grid_data_model::entities::*; +use flowy_grid_data_model::revision::*; #[test] fn grid_default_serde_test() { let grid_id = "1".to_owned(); - let grid = GridMeta { + let grid = GridRevision { grid_id, fields: vec![], blocks: vec![], diff --git a/shared-lib/flowy-sync/src/client_grid/grid_block_meta_pad.rs b/shared-lib/flowy-sync/src/client_grid/grid_block_revsion_pad.rs similarity index 72% rename from shared-lib/flowy-sync/src/client_grid/grid_block_meta_pad.rs rename to shared-lib/flowy-sync/src/client_grid/grid_block_revsion_pad.rs index 175890ad01..af187d5c37 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_block_meta_pad.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_block_revsion_pad.rs @@ -1,8 +1,8 @@ use crate::entities::revision::{md5, RepeatedRevision, Revision}; use crate::errors::{CollaborateError, CollaborateResult}; use crate::util::{cal_diff, make_delta_from_revisions}; -use flowy_grid_data_model::entities::{ - gen_block_id, gen_row_id, CellMeta, GridBlockMetaData, RowMeta, RowMetaChangeset, +use flowy_grid_data_model::revision::{ + gen_block_id, gen_row_id, CellRevision, GridBlockRevisionData, RowMetaChangeset, RowRevision, }; use lib_ot::core::{OperationTransformable, PlainTextAttributes, PlainTextDelta, PlainTextDeltaBuilder}; use serde::{Deserialize, Serialize}; @@ -11,20 +11,20 @@ use std::borrow::Cow; use std::collections::HashMap; use std::sync::Arc; -pub type GridBlockMetaDelta = PlainTextDelta; -pub type GridBlockMetaDeltaBuilder = PlainTextDeltaBuilder; +pub type GridBlockRevisionDelta = PlainTextDelta; +pub type GridBlockRevisionDeltaBuilder = PlainTextDeltaBuilder; #[derive(Debug, Deserialize, Serialize, Clone)] -pub struct GridBlockMetaPad { +pub struct GridBlockRevisionPad { block_id: String, - rows: Vec>, + rows: Vec>, #[serde(skip)] - pub(crate) delta: GridBlockMetaDelta, + pub(crate) delta: GridBlockRevisionDelta, } -impl GridBlockMetaPad { - pub async fn duplicate_data(&self, duplicated_block_id: &str) -> GridBlockMetaData { +impl GridBlockRevisionPad { + pub async fn duplicate_data(&self, duplicated_block_id: &str) -> GridBlockRevisionData { let duplicated_rows = self .rows .iter() @@ -34,34 +34,38 @@ impl GridBlockMetaPad { duplicated_row.block_id = duplicated_block_id.to_string(); duplicated_row }) - .collect::>(); - GridBlockMetaData { + .collect::>(); + GridBlockRevisionData { block_id: duplicated_block_id.to_string(), rows: duplicated_rows, } } - pub fn from_delta(delta: GridBlockMetaDelta) -> CollaborateResult { + pub fn from_delta(delta: GridBlockRevisionDelta) -> CollaborateResult { let s = delta.to_str()?; - let meta_data: GridBlockMetaData = serde_json::from_str(&s).map_err(|e| { + let meta_data: GridBlockRevisionData = serde_json::from_str(&s).map_err(|e| { let msg = format!("Deserialize delta to block meta failed: {}", e); tracing::error!("{}", s); CollaborateError::internal().context(msg) })?; let block_id = meta_data.block_id; - let rows = meta_data.rows.into_iter().map(Arc::new).collect::>>(); + let rows = meta_data + .rows + .into_iter() + .map(Arc::new) + .collect::>>(); Ok(Self { block_id, rows, delta }) } pub fn from_revisions(_grid_id: &str, revisions: Vec) -> CollaborateResult { - let block_delta: GridBlockMetaDelta = make_delta_from_revisions::(revisions)?; + let block_delta: GridBlockRevisionDelta = make_delta_from_revisions::(revisions)?; Self::from_delta(block_delta) } #[tracing::instrument(level = "trace", skip(self, row), err)] - pub fn add_row_meta( + pub fn add_row_rev( &mut self, - row: RowMeta, + row: RowRevision, start_row_id: Option, ) -> CollaborateResult> { self.modify(|rows| { @@ -86,7 +90,7 @@ impl GridBlockMetaPad { }) } - pub fn get_row_metas(&self, row_ids: Option>>) -> CollaborateResult>> + pub fn get_row_revs(&self, row_ids: Option>>) -> CollaborateResult>> where T: AsRef + ToOwned + ?Sized, { @@ -97,7 +101,7 @@ impl GridBlockMetaPad { .rows .iter() .map(|row| (row.id.as_str(), row.clone())) - .collect::>>(); + .collect::>>(); Ok(row_ids .iter() @@ -116,20 +120,20 @@ impl GridBlockMetaPad { } } - pub fn get_cell_metas( + pub fn get_cell_revs( &self, field_id: &str, row_ids: Option>>, - ) -> CollaborateResult> { - let rows = self.get_row_metas(row_ids)?; - let cell_metas = rows + ) -> CollaborateResult> { + let rows = self.get_row_revs(row_ids)?; + let cell_revs = rows .iter() .flat_map(|row| { - let cell_meta = row.cells.get(field_id)?; - Some(cell_meta.clone()) + let cell_rev = row.cells.get(field_id)?; + Some(cell_rev.clone()) }) - .collect::>(); - Ok(cell_metas) + .collect::>(); + Ok(cell_revs) } pub fn number_of_rows(&self) -> i32 { @@ -169,11 +173,11 @@ impl GridBlockMetaPad { } pub fn move_row(&mut self, row_id: &str, from: usize, to: usize) -> CollaborateResult> { - self.modify(|row_metas| { - if let Some(position) = row_metas.iter().position(|row_meta| row_meta.id == row_id) { + self.modify(|row_revs| { + if let Some(position) = row_revs.iter().position(|row_rev| row_rev.id == row_id) { debug_assert_eq!(from, position); - let row_meta = row_metas.remove(position); - row_metas.insert(to, row_meta); + let row_rev = row_revs.remove(position); + row_revs.insert(to, row_rev); Ok(Some(())) } else { Ok(None) @@ -183,7 +187,7 @@ impl GridBlockMetaPad { pub fn modify(&mut self, f: F) -> CollaborateResult> where - F: for<'a> FnOnce(&'a mut Vec>) -> CollaborateResult>, + F: for<'a> FnOnce(&'a mut Vec>) -> CollaborateResult>, { let cloned_self = self.clone(); match f(&mut self.rows)? { @@ -209,11 +213,11 @@ impl GridBlockMetaPad { fn modify_row(&mut self, row_id: &str, f: F) -> CollaborateResult> where - F: FnOnce(&mut RowMeta) -> CollaborateResult>, + F: FnOnce(&mut RowRevision) -> CollaborateResult>, { self.modify(|rows| { - if let Some(row_meta) = rows.iter_mut().find(|row_meta| row_id == row_meta.id) { - f(Arc::make_mut(row_meta)) + if let Some(row_rev) = rows.iter_mut().find(|row_rev| row_id == row_rev.id) { + f(Arc::make_mut(row_rev)) } else { tracing::warn!("[BlockMetaPad]: Can't find any row with id: {}", row_id); Ok(None) @@ -236,32 +240,32 @@ impl GridBlockMetaPad { } pub struct GridBlockMetaChange { - pub delta: GridBlockMetaDelta, + pub delta: GridBlockRevisionDelta, /// md5: the md5 of the grid after applying the change. pub md5: String, } -pub fn make_block_meta_delta(grid_block_meta_data: &GridBlockMetaData) -> GridBlockMetaDelta { +pub fn make_block_meta_delta(grid_block_meta_data: &GridBlockRevisionData) -> GridBlockRevisionDelta { let json = serde_json::to_string(&grid_block_meta_data).unwrap(); PlainTextDeltaBuilder::new().insert(&json).build() } -pub fn make_block_meta_revisions(user_id: &str, grid_block_meta_data: &GridBlockMetaData) -> RepeatedRevision { +pub fn make_block_meta_revisions(user_id: &str, grid_block_meta_data: &GridBlockRevisionData) -> RepeatedRevision { let delta = make_block_meta_delta(grid_block_meta_data); let bytes = delta.to_delta_bytes(); let revision = Revision::initial_revision(user_id, &grid_block_meta_data.block_id, bytes); revision.into() } -impl std::default::Default for GridBlockMetaPad { +impl std::default::Default for GridBlockRevisionPad { fn default() -> Self { - let block_meta_data = GridBlockMetaData { + let block_meta_data = GridBlockRevisionData { block_id: gen_block_id(), rows: vec![], }; let delta = make_block_meta_delta(&block_meta_data); - GridBlockMetaPad { + GridBlockRevisionPad { block_id: block_meta_data.block_id, rows: block_meta_data.rows.into_iter().map(Arc::new).collect::>(), delta, @@ -271,14 +275,14 @@ impl std::default::Default for GridBlockMetaPad { #[cfg(test)] mod tests { - use crate::client_grid::{GridBlockMetaDelta, GridBlockMetaPad}; - use flowy_grid_data_model::entities::{RowMeta, RowMetaChangeset}; + use crate::client_grid::{GridBlockRevisionDelta, GridBlockRevisionPad}; + use flowy_grid_data_model::revision::{RowMetaChangeset, RowRevision}; use std::borrow::Cow; #[test] fn block_meta_add_row() { let mut pad = test_pad(); - let row = RowMeta { + let row = RowRevision { id: "1".to_string(), block_id: pad.block_id.clone(), cells: Default::default(), @@ -286,7 +290,7 @@ mod tests { visibility: false, }; - let change = pad.add_row_meta(row.clone(), None).unwrap().unwrap(); + let change = pad.add_row_rev(row.clone(), None).unwrap().unwrap(); assert_eq!(pad.rows.first().unwrap().as_ref(), &row); assert_eq!( change.delta.to_delta_str(), @@ -297,23 +301,23 @@ mod tests { #[test] fn block_meta_insert_row() { let mut pad = test_pad(); - let row_1 = test_row_meta("1", &pad); - let row_2 = test_row_meta("2", &pad); - let row_3 = test_row_meta("3", &pad); + let row_1 = test_row_rev("1", &pad); + let row_2 = test_row_rev("2", &pad); + let row_3 = test_row_rev("3", &pad); - let change = pad.add_row_meta(row_1.clone(), None).unwrap().unwrap(); + let change = pad.add_row_rev(row_1.clone(), None).unwrap().unwrap(); assert_eq!( change.delta.to_delta_str(), r#"[{"retain":24},{"insert":"{\"id\":\"1\",\"block_id\":\"1\",\"cells\":[],\"height\":0,\"visibility\":false}"},{"retain":2}]"# ); - let change = pad.add_row_meta(row_2.clone(), None).unwrap().unwrap(); + let change = pad.add_row_rev(row_2.clone(), None).unwrap().unwrap(); assert_eq!( change.delta.to_delta_str(), r#"[{"retain":90},{"insert":",{\"id\":\"2\",\"block_id\":\"1\",\"cells\":[],\"height\":0,\"visibility\":false}"},{"retain":2}]"# ); - let change = pad.add_row_meta(row_3.clone(), Some("2".to_string())).unwrap().unwrap(); + let change = pad.add_row_rev(row_3.clone(), Some("2".to_string())).unwrap().unwrap(); assert_eq!( change.delta.to_delta_str(), r#"[{"retain":157},{"insert":",{\"id\":\"3\",\"block_id\":\"1\",\"cells\":[],\"height\":0,\"visibility\":false}"},{"retain":2}]"# @@ -324,8 +328,8 @@ mod tests { assert_eq!(*pad.rows[2], row_3); } - fn test_row_meta(id: &str, pad: &GridBlockMetaPad) -> RowMeta { - RowMeta { + fn test_row_rev(id: &str, pad: &GridBlockRevisionPad) -> RowRevision { + RowRevision { id: id.to_string(), block_id: pad.block_id.clone(), cells: Default::default(), @@ -337,13 +341,13 @@ mod tests { #[test] fn block_meta_insert_row2() { let mut pad = test_pad(); - let row_1 = test_row_meta("1", &pad); - let row_2 = test_row_meta("2", &pad); - let row_3 = test_row_meta("3", &pad); + let row_1 = test_row_rev("1", &pad); + let row_2 = test_row_rev("2", &pad); + let row_3 = test_row_rev("3", &pad); - let _ = pad.add_row_meta(row_1.clone(), None).unwrap().unwrap(); - let _ = pad.add_row_meta(row_2.clone(), None).unwrap().unwrap(); - let _ = pad.add_row_meta(row_3.clone(), Some("1".to_string())).unwrap().unwrap(); + let _ = pad.add_row_rev(row_1.clone(), None).unwrap().unwrap(); + let _ = pad.add_row_rev(row_2.clone(), None).unwrap().unwrap(); + let _ = pad.add_row_rev(row_3.clone(), Some("1".to_string())).unwrap().unwrap(); assert_eq!(*pad.rows[0], row_1); assert_eq!(*pad.rows[1], row_3); @@ -353,13 +357,13 @@ mod tests { #[test] fn block_meta_insert_row3() { let mut pad = test_pad(); - let row_1 = test_row_meta("1", &pad); - let row_2 = test_row_meta("2", &pad); - let row_3 = test_row_meta("3", &pad); + let row_1 = test_row_rev("1", &pad); + let row_2 = test_row_rev("2", &pad); + let row_3 = test_row_rev("3", &pad); - let _ = pad.add_row_meta(row_1.clone(), None).unwrap().unwrap(); - let _ = pad.add_row_meta(row_2.clone(), None).unwrap().unwrap(); - let _ = pad.add_row_meta(row_3.clone(), Some("".to_string())).unwrap().unwrap(); + let _ = pad.add_row_rev(row_1.clone(), None).unwrap().unwrap(); + let _ = pad.add_row_rev(row_2.clone(), None).unwrap().unwrap(); + let _ = pad.add_row_rev(row_3.clone(), Some("".to_string())).unwrap().unwrap(); assert_eq!(*pad.rows[0], row_1); assert_eq!(*pad.rows[1], row_2); @@ -370,7 +374,7 @@ mod tests { fn block_meta_delete_row() { let mut pad = test_pad(); let pre_delta_str = pad.delta_str(); - let row = RowMeta { + let row = RowRevision { id: "1".to_string(), block_id: pad.block_id.clone(), cells: Default::default(), @@ -378,7 +382,7 @@ mod tests { visibility: false, }; - let _ = pad.add_row_meta(row.clone(), None).unwrap().unwrap(); + let _ = pad.add_row_rev(row.clone(), None).unwrap().unwrap(); let change = pad.delete_rows(vec![Cow::Borrowed(&row.id)]).unwrap().unwrap(); assert_eq!( change.delta.to_delta_str(), @@ -391,7 +395,7 @@ mod tests { #[test] fn block_meta_update_row() { let mut pad = test_pad(); - let row = RowMeta { + let row = RowRevision { id: "1".to_string(), block_id: pad.block_id.clone(), cells: Default::default(), @@ -406,7 +410,7 @@ mod tests { cell_by_field_id: Default::default(), }; - let _ = pad.add_row_meta(row, None).unwrap().unwrap(); + let _ = pad.add_row_rev(row, None).unwrap().unwrap(); let change = pad.update_row(changeset).unwrap().unwrap(); assert_eq!( @@ -420,8 +424,9 @@ mod tests { ); } - fn test_pad() -> GridBlockMetaPad { - let delta = GridBlockMetaDelta::from_delta_str(r#"[{"insert":"{\"block_id\":\"1\",\"rows\":[]}"}]"#).unwrap(); - GridBlockMetaPad::from_delta(delta).unwrap() + fn test_pad() -> GridBlockRevisionPad { + let delta = + GridBlockRevisionDelta::from_delta_str(r#"[{"insert":"{\"block_id\":\"1\",\"rows\":[]}"}]"#).unwrap(); + GridBlockRevisionPad::from_delta(delta).unwrap() } } diff --git a/shared-lib/flowy-sync/src/client_grid/grid_builder.rs b/shared-lib/flowy-sync/src/client_grid/grid_builder.rs index 95e707a287..ae68f0a5fa 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_builder.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_builder.rs @@ -1,5 +1,7 @@ use crate::errors::{CollaborateError, CollaborateResult}; -use flowy_grid_data_model::entities::{BuildGridContext, FieldMeta, GridBlockMeta, GridBlockMetaData, RowMeta}; +use flowy_grid_data_model::revision::{ + BuildGridContext, FieldRevision, GridBlockRevision, GridBlockRevisionData, RowRevision, +}; pub struct GridBuilder { build_context: BuildGridContext, @@ -9,8 +11,8 @@ impl std::default::Default for GridBuilder { fn default() -> Self { let mut build_context = BuildGridContext::new(); - let block_meta = GridBlockMeta::new(); - let block_meta_data = GridBlockMetaData { + let block_meta = GridBlockRevision::new(); + let block_meta_data = GridBlockRevisionData { block_id: block_meta.block_id.clone(), rows: vec![], }; @@ -23,13 +25,13 @@ impl std::default::Default for GridBuilder { } impl GridBuilder { - pub fn add_field(mut self, field: FieldMeta) -> Self { - self.build_context.field_metas.push(field); + pub fn add_field(mut self, field: FieldRevision) -> Self { + self.build_context.field_revs.push(field); self } pub fn add_empty_row(mut self) -> Self { - let row = RowMeta::new(&self.build_context.blocks.first().unwrap().block_id); + let row = RowRevision::new(&self.build_context.blocks.first().unwrap().block_id); let block_meta = self.build_context.blocks.first_mut().unwrap(); let block_meta_data = self.build_context.blocks_meta_data.first_mut().unwrap(); block_meta_data.rows.push(row); @@ -43,7 +45,7 @@ impl GridBuilder { } #[allow(dead_code)] -fn check_rows(fields: &[FieldMeta], rows: &[RowMeta]) -> CollaborateResult<()> { +fn check_rows(fields: &[FieldRevision], rows: &[RowRevision]) -> CollaborateResult<()> { let field_ids = fields.iter().map(|field| &field.id).collect::>(); for row in rows { let cell_field_ids = row.cells.keys().into_iter().collect::>(); @@ -59,29 +61,30 @@ fn check_rows(fields: &[FieldMeta], rows: &[RowMeta]) -> CollaborateResult<()> { mod tests { use crate::client_grid::{make_block_meta_delta, make_grid_delta, GridBuilder}; - use flowy_grid_data_model::entities::{FieldMeta, FieldType, GridBlockMetaData, GridMeta}; + use flowy_grid_data_model::entities::FieldType; + use flowy_grid_data_model::revision::{FieldRevision, GridBlockRevisionData, GridRevision}; #[test] fn create_default_grid_test() { let grid_id = "1".to_owned(); let build_context = GridBuilder::default() - .add_field(FieldMeta::new("Name", "", FieldType::RichText, true)) - .add_field(FieldMeta::new("Tags", "", FieldType::SingleSelect, false)) + .add_field(FieldRevision::new("Name", "", FieldType::RichText, true)) + .add_field(FieldRevision::new("Tags", "", FieldType::SingleSelect, false)) .add_empty_row() .add_empty_row() .add_empty_row() .build(); - let grid_meta = GridMeta { + let grid_rev = GridRevision { grid_id, - fields: build_context.field_metas, + fields: build_context.field_revs, blocks: build_context.blocks, }; - let grid_meta_delta = make_grid_delta(&grid_meta); - let _: GridMeta = serde_json::from_str(&grid_meta_delta.to_str().unwrap()).unwrap(); + let grid_meta_delta = make_grid_delta(&grid_rev); + let _: GridRevision = serde_json::from_str(&grid_meta_delta.to_str().unwrap()).unwrap(); let grid_block_meta_delta = make_block_meta_delta(build_context.blocks_meta_data.first().unwrap()); - let _: GridBlockMetaData = serde_json::from_str(&grid_block_meta_delta.to_str().unwrap()).unwrap(); + let _: GridBlockRevisionData = serde_json::from_str(&grid_block_meta_delta.to_str().unwrap()).unwrap(); } } diff --git a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs b/shared-lib/flowy-sync/src/client_grid/grid_revision_pad.rs similarity index 72% rename from shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs rename to shared-lib/flowy-sync/src/client_grid/grid_revision_pad.rs index da80dfebd0..3173612896 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_revision_pad.rs @@ -2,33 +2,35 @@ use crate::entities::revision::{md5, RepeatedRevision, Revision}; use crate::errors::{internal_error, CollaborateError, CollaborateResult}; use crate::util::{cal_diff, make_delta_from_revisions}; use bytes::Bytes; -use flowy_grid_data_model::entities::{ - gen_block_id, gen_grid_id, FieldChangesetParams, FieldMeta, FieldOrder, FieldType, GridBlockMeta, - GridBlockMetaChangeset, GridMeta, +use flowy_grid_data_model::entities::FieldType; +use flowy_grid_data_model::entities::{FieldChangesetParams, FieldOrder}; +use flowy_grid_data_model::revision::{ + gen_block_id, gen_grid_id, FieldRevision, GridBlockRevision, GridBlockRevisionChangeset, GridRevision, }; +use futures::StreamExt; use lib_infra::util::move_vec_element; use lib_ot::core::{OperationTransformable, PlainTextAttributes, PlainTextDelta, PlainTextDeltaBuilder}; use std::collections::HashMap; use std::sync::Arc; -pub type GridMetaDelta = PlainTextDelta; -pub type GridDeltaBuilder = PlainTextDeltaBuilder; +pub type GridRevisionDelta = PlainTextDelta; +pub type GridRevisionDeltaBuilder = PlainTextDeltaBuilder; -pub struct GridMetaPad { - pub(crate) grid_meta: Arc, - pub(crate) delta: GridMetaDelta, +pub struct GridRevisionPad { + pub(crate) grid_rev: Arc, + pub(crate) delta: GridRevisionDelta, } pub trait JsonDeserializer { fn deserialize(&self, type_option_data: Vec) -> CollaborateResult; } -impl GridMetaPad { - pub async fn duplicate_grid_meta(&self) -> (Vec, Vec) { - let fields = self.grid_meta.fields.to_vec(); +impl GridRevisionPad { + pub async fn duplicate_grid_meta(&self) -> (Vec, Vec) { + let fields = self.grid_rev.fields.to_vec(); let blocks = self - .grid_meta + .grid_rev .blocks .iter() .map(|block| { @@ -36,31 +38,31 @@ impl GridMetaPad { duplicated_block.block_id = gen_block_id(); duplicated_block }) - .collect::>(); + .collect::>(); (fields, blocks) } - pub fn from_delta(delta: GridMetaDelta) -> CollaborateResult { + pub fn from_delta(delta: GridRevisionDelta) -> CollaborateResult { let s = delta.to_str()?; - let grid: GridMeta = serde_json::from_str(&s) + let grid: GridRevision = serde_json::from_str(&s) .map_err(|e| CollaborateError::internal().context(format!("Deserialize delta to grid failed: {}", e)))?; Ok(Self { - grid_meta: Arc::new(grid), + grid_rev: Arc::new(grid), delta, }) } pub fn from_revisions(_grid_id: &str, revisions: Vec) -> CollaborateResult { - let grid_delta: GridMetaDelta = make_delta_from_revisions::(revisions)?; + let grid_delta: GridRevisionDelta = make_delta_from_revisions::(revisions)?; Self::from_delta(grid_delta) } #[tracing::instrument(level = "debug", skip_all, err)] - pub fn create_field_meta( + pub fn create_field_rev( &mut self, - new_field_meta: FieldMeta, + new_field_rev: FieldRevision, start_field_id: Option, ) -> CollaborateResult> { self.modify_grid(|grid_meta| { @@ -68,7 +70,7 @@ impl GridMetaPad { if grid_meta .fields .iter() - .any(|field_meta| field_meta.id == new_field_meta.id) + .any(|field_rev| field_rev.id == new_field_rev.id) { tracing::error!("Duplicate grid field"); return Ok(None); @@ -80,14 +82,14 @@ impl GridMetaPad { }; match insert_index { - None => grid_meta.fields.push(new_field_meta), - Some(index) => grid_meta.fields.insert(index, new_field_meta), + None => grid_meta.fields.push(new_field_rev), + Some(index) => grid_meta.fields.insert(index, new_field_rev), } Ok(Some(())) }) } - pub fn delete_field_meta(&mut self, field_id: &str) -> CollaborateResult> { + pub fn delete_field_rev(&mut self, field_id: &str) -> CollaborateResult> { self.modify_grid( |grid_meta| match grid_meta.fields.iter().position(|field| field.id == field_id) { None => Ok(None), @@ -99,7 +101,7 @@ impl GridMetaPad { ) } - pub fn duplicate_field_meta( + pub fn duplicate_field_rev( &mut self, field_id: &str, duplicated_field_id: &str, @@ -108,10 +110,10 @@ impl GridMetaPad { |grid_meta| match grid_meta.fields.iter().position(|field| field.id == field_id) { None => Ok(None), Some(index) => { - let mut duplicate_field_meta = grid_meta.fields[index].clone(); - duplicate_field_meta.id = duplicated_field_id.to_string(); - duplicate_field_meta.name = format!("{} (copy)", duplicate_field_meta.name); - grid_meta.fields.insert(index + 1, duplicate_field_meta); + let mut duplicate_field_rev = grid_meta.fields[index].clone(); + duplicate_field_rev.id = duplicated_field_id.to_string(); + duplicate_field_rev.name = format!("{} (copy)", duplicate_field_rev.name); + grid_meta.fields.insert(index + 1, duplicate_field_rev); Ok(Some(())) } }, @@ -129,25 +131,25 @@ impl GridMetaPad { { self.modify_grid(|grid_meta| { // - match grid_meta.fields.iter_mut().find(|field_meta| field_meta.id == field_id) { + match grid_meta.fields.iter_mut().find(|field_rev| field_rev.id == field_id) { None => { tracing::warn!("Can not find the field with id: {}", field_id); Ok(None) } - Some(field_meta) => { - if field_meta.get_type_option_str(&field_type).is_none() { + Some(field_rev) => { + if field_rev.get_type_option_str(&field_type).is_none() { let type_option_json = type_option_json_builder(&field_type); - field_meta.insert_type_option_str(&field_type, type_option_json); + field_rev.insert_type_option_str(&field_type, type_option_json); } - field_meta.field_type = field_type; + field_rev.field_type = field_type; Ok(Some(())) } } }) } - pub fn update_field_meta( + pub fn update_field_rev( &mut self, changeset: FieldChangesetParams, deserializer: T, @@ -202,21 +204,21 @@ impl GridMetaPad { }) } - pub fn get_field_meta(&self, field_id: &str) -> Option<(usize, &FieldMeta)> { - self.grid_meta + pub fn get_field_rev(&self, field_id: &str) -> Option<(usize, &FieldRevision)> { + self.grid_rev .fields .iter() .enumerate() .find(|(_, field)| field.id == field_id) } - pub fn replace_field_meta(&mut self, field_meta: FieldMeta) -> CollaborateResult> { + pub fn replace_field_rev(&mut self, field_rev: FieldRevision) -> CollaborateResult> { self.modify_grid( - |grid_meta| match grid_meta.fields.iter().position(|field| field.id == field_meta.id) { + |grid_meta| match grid_meta.fields.iter().position(|field| field.id == field_rev.id) { None => Ok(None), Some(index) => { grid_meta.fields.remove(index); - grid_meta.fields.insert(index, field_meta); + grid_meta.fields.insert(index, field_rev); Ok(Some(())) } }, @@ -245,23 +247,23 @@ impl GridMetaPad { } pub fn contain_field(&self, field_id: &str) -> bool { - self.grid_meta.fields.iter().any(|field| field.id == field_id) + self.grid_rev.fields.iter().any(|field| field.id == field_id) } pub fn get_field_orders(&self) -> Vec { - self.grid_meta.fields.iter().map(FieldOrder::from).collect() + self.grid_rev.fields.iter().map(FieldOrder::from).collect() } - pub fn get_field_metas(&self, field_orders: Option>) -> CollaborateResult> { + pub fn get_field_revs(&self, field_orders: Option>) -> CollaborateResult> { match field_orders { - None => Ok(self.grid_meta.fields.clone()), + None => Ok(self.grid_rev.fields.clone()), Some(field_orders) => { let field_by_field_id = self - .grid_meta + .grid_rev .fields .iter() .map(|field| (&field.id, field)) - .collect::>(); + .collect::>(); let fields = field_orders .iter() @@ -272,13 +274,13 @@ impl GridMetaPad { } Some(field) => Some((*field).clone()), }) - .collect::>(); + .collect::>(); Ok(fields) } } } - pub fn create_block_meta(&mut self, block: GridBlockMeta) -> CollaborateResult> { + pub fn create_block_meta(&mut self, block: GridBlockRevision) -> CollaborateResult> { self.modify_grid(|grid_meta| { if grid_meta.blocks.iter().any(|b| b.block_id == block.block_id) { tracing::warn!("Duplicate grid block"); @@ -301,11 +303,14 @@ impl GridMetaPad { }) } - pub fn get_block_metas(&self) -> Vec { - self.grid_meta.blocks.clone() + pub fn get_block_metas(&self) -> Vec { + self.grid_rev.blocks.clone() } - pub fn update_block_meta(&mut self, changeset: GridBlockMetaChangeset) -> CollaborateResult> { + pub fn update_block_meta( + &mut self, + changeset: GridBlockRevisionChangeset, + ) -> CollaborateResult> { let block_id = changeset.block_id.clone(); self.modify_block(&block_id, |block| { let mut is_changed = None; @@ -336,20 +341,20 @@ impl GridMetaPad { self.delta.to_delta_bytes() } - pub fn fields(&self) -> &[FieldMeta] { - &self.grid_meta.fields + pub fn fields(&self) -> &[FieldRevision] { + &self.grid_rev.fields } fn modify_grid(&mut self, f: F) -> CollaborateResult> where - F: FnOnce(&mut GridMeta) -> CollaborateResult>, + F: FnOnce(&mut GridRevision) -> CollaborateResult>, { - let cloned_grid = self.grid_meta.clone(); - match f(Arc::make_mut(&mut self.grid_meta))? { + let cloned_grid = self.grid_rev.clone(); + match f(Arc::make_mut(&mut self.grid_rev))? { None => Ok(None), Some(_) => { let old = json_from_grid(&cloned_grid)?; - let new = json_from_grid(&self.grid_meta)?; + let new = json_from_grid(&self.grid_rev)?; match cal_diff::(old, new) { None => Ok(None), Some(delta) => { @@ -363,7 +368,7 @@ impl GridMetaPad { pub fn modify_block(&mut self, block_id: &str, f: F) -> CollaborateResult> where - F: FnOnce(&mut GridBlockMeta) -> CollaborateResult>, + F: FnOnce(&mut GridBlockRevision) -> CollaborateResult>, { self.modify_grid( |grid_meta| match grid_meta.blocks.iter().position(|block| block.block_id == block_id) { @@ -378,7 +383,7 @@ impl GridMetaPad { pub fn modify_field(&mut self, field_id: &str, f: F) -> CollaborateResult> where - F: FnOnce(&mut FieldMeta) -> CollaborateResult>, + F: FnOnce(&mut FieldRevision) -> CollaborateResult>, { self.modify_grid( |grid_meta| match grid_meta.fields.iter().position(|field| field.id == field_id) { @@ -392,40 +397,40 @@ impl GridMetaPad { } } -fn json_from_grid(grid: &Arc) -> CollaborateResult { +fn json_from_grid(grid: &Arc) -> CollaborateResult { let json = serde_json::to_string(grid) .map_err(|err| internal_error(format!("Serialize grid to json str failed. {:?}", err)))?; Ok(json) } pub struct GridChangeset { - pub delta: GridMetaDelta, + pub delta: GridRevisionDelta, /// md5: the md5 of the grid after applying the change. pub md5: String, } -pub fn make_grid_delta(grid_meta: &GridMeta) -> GridMetaDelta { - let json = serde_json::to_string(&grid_meta).unwrap(); +pub fn make_grid_delta(grid_rev: &GridRevision) -> GridRevisionDelta { + let json = serde_json::to_string(&grid_rev).unwrap(); PlainTextDeltaBuilder::new().insert(&json).build() } -pub fn make_grid_revisions(user_id: &str, grid_meta: &GridMeta) -> RepeatedRevision { - let delta = make_grid_delta(grid_meta); +pub fn make_grid_revisions(user_id: &str, grid_rev: &GridRevision) -> RepeatedRevision { + let delta = make_grid_delta(grid_rev); let bytes = delta.to_delta_bytes(); - let revision = Revision::initial_revision(user_id, &grid_meta.grid_id, bytes); + let revision = Revision::initial_revision(user_id, &grid_rev.grid_id, bytes); revision.into() } -impl std::default::Default for GridMetaPad { +impl std::default::Default for GridRevisionPad { fn default() -> Self { - let grid = GridMeta { + let grid = GridRevision { grid_id: gen_grid_id(), fields: vec![], blocks: vec![], }; let delta = make_grid_delta(&grid); - GridMetaPad { - grid_meta: Arc::new(grid), + GridRevisionPad { + grid_rev: Arc::new(grid), delta, } } diff --git a/shared-lib/flowy-sync/src/client_grid/mod.rs b/shared-lib/flowy-sync/src/client_grid/mod.rs index 5df06e7858..e76ae0cefe 100644 --- a/shared-lib/flowy-sync/src/client_grid/mod.rs +++ b/shared-lib/flowy-sync/src/client_grid/mod.rs @@ -1,7 +1,7 @@ -mod grid_block_meta_pad; +mod grid_block_revsion_pad; mod grid_builder; -mod grid_meta_pad; +mod grid_revision_pad; -pub use grid_block_meta_pad::*; +pub use grid_block_revsion_pad::*; pub use grid_builder::*; -pub use grid_meta_pad::*; +pub use grid_revision_pad::*; From 820b7fcb750a4fef123fc776e37dfa23eb75e33d Mon Sep 17 00:00:00 2001 From: appflowy Date: Wed, 15 Jun 2022 17:24:46 +0800 Subject: [PATCH 11/11] refactor: add grid view info --- frontend/app_flowy/analysis_options.yaml | 3 +- .../presentation/plugins/board/board.dart | 2 +- .../packages/flowy_sdk/analysis_options.yaml | 1 + .../dart_event/flowy-folder/dart_event.dart | 17 - .../flowy-folder-data-model/view_info.pb.dart | 393 +---- .../view_info.pbjson.dart | 68 +- .../flowy-folder/event_map.pbenum.dart | 2 - .../flowy-folder/event_map.pbjson.dart | 3 +- .../flowy-grid-data-model/grid_info.pb.dart | 433 +++++ .../grid_info.pbenum.dart | 7 + .../grid_info.pbjson.dart | 81 + .../grid_info.pbserver.dart | 9 + .../flowy-grid-data-model/protobuf.dart | 1 + .../rust-lib/flowy-folder/src/event_map.rs | 4 - frontend/rust-lib/flowy-folder/src/manager.rs | 7 +- .../src/protobuf/model/event_map.rs | 16 +- .../src/protobuf/proto/event_map.proto | 1 - .../src/services/folder_editor.rs | 12 +- .../src/services/view/controller.rs | 10 +- .../src/services/view/event_handler.rs | 13 +- frontend/rust-lib/flowy-grid/src/manager.rs | 3 +- .../type_options/checkbox_type_option.rs | 2 +- .../field/type_options/date_type_option.rs | 2 +- .../number_type_option/number_type_option.rs | 2 +- .../type_options/selection_type_option.rs | 4 +- .../field/type_options/url_type_option.rs | 2 +- .../src/services/row/row_builder.rs | 5 +- .../flowy-sdk/src/deps_resolve/folder_deps.rs | 10 - .../src/entities/view_info.rs | 91 +- .../flowy-folder-data-model/src/parser/mod.rs | 1 - .../src/parser/view_info/mod.rs | 5 - .../src/parser/view_info/object_id.rs | 19 - .../src/parser/view_info/view_ext.rs | 40 - .../src/protobuf/model/view_info.rs | 1340 +-------------- .../src/protobuf/proto/view_info.proto | 23 +- .../src/revision/{app.rs => app_rev.rs} | 0 .../src/revision/mod.rs | 16 +- .../src/revision/{trash.rs => trash_rev.rs} | 0 .../src/revision/view.rs | 142 -- .../src/revision/view_rev.rs | 71 + .../{workspace.rs => workspace_rev.rs} | 0 .../src/entities/field.rs | 4 +- .../src/entities/grid.rs | 2 +- .../src/entities/grid_info.rs | 91 ++ .../flowy-grid-data-model/src/entities/mod.rs | 2 + .../src/parser/grid_info_parser.rs | 58 + .../flowy-grid-data-model/src/parser/mod.rs | 2 + .../src/protobuf/model/grid_info.rs | 1444 +++++++++++++++++ .../src/protobuf/model/mod.rs | 3 + .../src/protobuf/proto/grid_info.proto | 23 + .../src/revision/grid_info_rev.rs | 66 + .../src/revision/grid_rev.rs | 310 ++++ .../flowy-grid-data-model/src/revision/mod.rs | 299 +--- .../flowy-grid-data-model/tests/serde_test.rs | 6 +- .../src/client_grid/grid_builder.rs | 1 + .../src/client_grid/grid_revision_pad.rs | 7 +- 56 files changed, 2673 insertions(+), 2506 deletions(-) create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pb.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbenum.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbjson.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbserver.dart delete mode 100644 shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs delete mode 100644 shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs delete mode 100644 shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs rename shared-lib/flowy-folder-data-model/src/revision/{app.rs => app_rev.rs} (100%) rename shared-lib/flowy-folder-data-model/src/revision/{trash.rs => trash_rev.rs} (100%) delete mode 100644 shared-lib/flowy-folder-data-model/src/revision/view.rs create mode 100644 shared-lib/flowy-folder-data-model/src/revision/view_rev.rs rename shared-lib/flowy-folder-data-model/src/revision/{workspace.rs => workspace_rev.rs} (100%) create mode 100644 shared-lib/flowy-grid-data-model/src/entities/grid_info.rs create mode 100644 shared-lib/flowy-grid-data-model/src/parser/grid_info_parser.rs create mode 100644 shared-lib/flowy-grid-data-model/src/protobuf/model/grid_info.rs create mode 100644 shared-lib/flowy-grid-data-model/src/protobuf/proto/grid_info.proto create mode 100644 shared-lib/flowy-grid-data-model/src/revision/grid_info_rev.rs create mode 100644 shared-lib/flowy-grid-data-model/src/revision/grid_rev.rs diff --git a/frontend/app_flowy/analysis_options.yaml b/frontend/app_flowy/analysis_options.yaml index fbd3eeee72..5717d49105 100644 --- a/frontend/app_flowy/analysis_options.yaml +++ b/frontend/app_flowy/analysis_options.yaml @@ -17,7 +17,6 @@ analyzer: - "packages/flowy_editor/**" - "packages/editor/**" # - "packages/flowy_infra_ui/**" - linter: # The lint rules applied to this project can be customized in the # section below to disable rules from the `package:flutter_lints/flutter.yaml` @@ -38,4 +37,4 @@ linter: # https://dart.dev/guides/language/analysis-options errors: - invalid_annotation_target: ignore \ No newline at end of file + invalid_annotation_target: ignore diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart index fb55fc70c1..041f1c4713 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/board/board.dart @@ -28,7 +28,7 @@ class BoardPluginBuilder implements PluginBuilder { class BoardPluginConfig implements PluginConfig { @override - bool get creatable => true; + bool get creatable => false; } class BoardPlugin extends Plugin { diff --git a/frontend/app_flowy/packages/flowy_sdk/analysis_options.yaml b/frontend/app_flowy/packages/flowy_sdk/analysis_options.yaml index 1ddc9bdf8b..3cb5a0adbb 100644 --- a/frontend/app_flowy/packages/flowy_sdk/analysis_options.yaml +++ b/frontend/app_flowy/packages/flowy_sdk/analysis_options.yaml @@ -1,4 +1,5 @@ analyzer: exclude: - "**/*.g.dart" + - "**/*.pb.dart" - "**/*.freezed.dart" diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart index e411bf9f00..064fae1fa4 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-folder/dart_event.dart @@ -287,23 +287,6 @@ class FolderEventReadViewInfo { } } -class FolderEventUpdateViewInfo { - UpdateViewInfoPayload request; - FolderEventUpdateViewInfo(this.request); - - Future> send() { - final request = FFIRequest.create() - ..event = FolderEvent.UpdateViewInfo.toString() - ..payload = requestToBytes(this.request); - - return Dispatch.asyncRequest(request) - .then((bytesResult) => bytesResult.fold( - (okBytes) => left(ViewInfo.fromBuffer(okBytes)), - (errBytes) => right(FlowyError.fromBuffer(errBytes)), - )); - } -} - class FolderEventCopyLink { FolderEventCopyLink(); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart index 6351757563..23430dafb2 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pb.dart @@ -21,7 +21,7 @@ class ViewInfo extends $pb.GeneratedMessage { ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') ..e<$0.ViewDataType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dataType', $pb.PbFieldType.OE, defaultOrMaker: $0.ViewDataType.TextBlock, valueOf: $0.ViewDataType.valueOf, enumValues: $0.ViewDataType.values) ..aOM<$0.RepeatedView>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: $0.RepeatedView.create) - ..aOM(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'extData', subBuilder: ViewExtData.create) + ..aOS(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'extData') ..hasRequiredFields = false ; @@ -33,7 +33,7 @@ class ViewInfo extends $pb.GeneratedMessage { $core.String? desc, $0.ViewDataType? dataType, $0.RepeatedView? belongings, - ViewExtData? extData, + $core.String? extData, }) { final _result = create(); if (id != null) { @@ -137,397 +137,12 @@ class ViewInfo extends $pb.GeneratedMessage { $0.RepeatedView ensureBelongings() => $_ensure(5); @$pb.TagNumber(7) - ViewExtData get extData => $_getN(6); + $core.String get extData => $_getSZ(6); @$pb.TagNumber(7) - set extData(ViewExtData v) { setField(7, v); } + set extData($core.String v) { $_setString(6, v); } @$pb.TagNumber(7) $core.bool hasExtData() => $_has(6); @$pb.TagNumber(7) void clearExtData() => clearField(7); - @$pb.TagNumber(7) - ViewExtData ensureExtData() => $_ensure(6); -} - -class ViewExtData extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewExtData', createEmptyInstance: create) - ..aOM(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) - ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) - ..hasRequiredFields = false - ; - - ViewExtData._() : super(); - factory ViewExtData({ - ViewFilter? filter, - ViewGroup? group, - ViewSort? sort, - }) { - final _result = create(); - if (filter != null) { - _result.filter = filter; - } - if (group != null) { - _result.group = group; - } - if (sort != null) { - _result.sort = sort; - } - return _result; - } - factory ViewExtData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewExtData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewExtData clone() => ViewExtData()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewExtData copyWith(void Function(ViewExtData) updates) => super.copyWith((message) => updates(message as ViewExtData)) as ViewExtData; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewExtData create() => ViewExtData._(); - ViewExtData createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewExtData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewExtData? _defaultInstance; - - @$pb.TagNumber(1) - ViewFilter get filter => $_getN(0); - @$pb.TagNumber(1) - set filter(ViewFilter v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasFilter() => $_has(0); - @$pb.TagNumber(1) - void clearFilter() => clearField(1); - @$pb.TagNumber(1) - ViewFilter ensureFilter() => $_ensure(0); - - @$pb.TagNumber(2) - ViewGroup get group => $_getN(1); - @$pb.TagNumber(2) - set group(ViewGroup v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasGroup() => $_has(1); - @$pb.TagNumber(2) - void clearGroup() => clearField(2); - @$pb.TagNumber(2) - ViewGroup ensureGroup() => $_ensure(1); - - @$pb.TagNumber(3) - ViewSort get sort => $_getN(2); - @$pb.TagNumber(3) - set sort(ViewSort v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasSort() => $_has(2); - @$pb.TagNumber(3) - void clearSort() => clearField(3); - @$pb.TagNumber(3) - ViewSort ensureSort() => $_ensure(2); -} - -class ViewFilter extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewFilter', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'objectId') - ..hasRequiredFields = false - ; - - ViewFilter._() : super(); - factory ViewFilter({ - $core.String? objectId, - }) { - final _result = create(); - if (objectId != null) { - _result.objectId = objectId; - } - return _result; - } - factory ViewFilter.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewFilter.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewFilter clone() => ViewFilter()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewFilter copyWith(void Function(ViewFilter) updates) => super.copyWith((message) => updates(message as ViewFilter)) as ViewFilter; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewFilter create() => ViewFilter._(); - ViewFilter createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewFilter getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewFilter? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get objectId => $_getSZ(0); - @$pb.TagNumber(1) - set objectId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasObjectId() => $_has(0); - @$pb.TagNumber(1) - void clearObjectId() => clearField(1); -} - -enum ViewGroup_OneOfSubGroupObjectId { - subGroupObjectId, - notSet -} - -class ViewGroup extends $pb.GeneratedMessage { - static const $core.Map<$core.int, ViewGroup_OneOfSubGroupObjectId> _ViewGroup_OneOfSubGroupObjectIdByTag = { - 2 : ViewGroup_OneOfSubGroupObjectId.subGroupObjectId, - 0 : ViewGroup_OneOfSubGroupObjectId.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewGroup', createEmptyInstance: create) - ..oo(0, [2]) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'groupObjectId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subGroupObjectId') - ..hasRequiredFields = false - ; - - ViewGroup._() : super(); - factory ViewGroup({ - $core.String? groupObjectId, - $core.String? subGroupObjectId, - }) { - final _result = create(); - if (groupObjectId != null) { - _result.groupObjectId = groupObjectId; - } - if (subGroupObjectId != null) { - _result.subGroupObjectId = subGroupObjectId; - } - return _result; - } - factory ViewGroup.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewGroup.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewGroup clone() => ViewGroup()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewGroup copyWith(void Function(ViewGroup) updates) => super.copyWith((message) => updates(message as ViewGroup)) as ViewGroup; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewGroup create() => ViewGroup._(); - ViewGroup createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewGroup getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewGroup? _defaultInstance; - - ViewGroup_OneOfSubGroupObjectId whichOneOfSubGroupObjectId() => _ViewGroup_OneOfSubGroupObjectIdByTag[$_whichOneof(0)]!; - void clearOneOfSubGroupObjectId() => clearField($_whichOneof(0)); - - @$pb.TagNumber(1) - $core.String get groupObjectId => $_getSZ(0); - @$pb.TagNumber(1) - set groupObjectId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasGroupObjectId() => $_has(0); - @$pb.TagNumber(1) - void clearGroupObjectId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get subGroupObjectId => $_getSZ(1); - @$pb.TagNumber(2) - set subGroupObjectId($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasSubGroupObjectId() => $_has(1); - @$pb.TagNumber(2) - void clearSubGroupObjectId() => clearField(2); -} - -class ViewSort extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewSort', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'objectId') - ..hasRequiredFields = false - ; - - ViewSort._() : super(); - factory ViewSort({ - $core.String? objectId, - }) { - final _result = create(); - if (objectId != null) { - _result.objectId = objectId; - } - return _result; - } - factory ViewSort.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ViewSort.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - ViewSort clone() => ViewSort()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - ViewSort copyWith(void Function(ViewSort) updates) => super.copyWith((message) => updates(message as ViewSort)) as ViewSort; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static ViewSort create() => ViewSort._(); - ViewSort createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static ViewSort getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static ViewSort? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get objectId => $_getSZ(0); - @$pb.TagNumber(1) - set objectId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasObjectId() => $_has(0); - @$pb.TagNumber(1) - void clearObjectId() => clearField(1); -} - -enum UpdateViewInfoPayload_OneOfFilter { - filter, - notSet -} - -enum UpdateViewInfoPayload_OneOfGroup { - group, - notSet -} - -enum UpdateViewInfoPayload_OneOfSort { - sort, - notSet -} - -class UpdateViewInfoPayload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, UpdateViewInfoPayload_OneOfFilter> _UpdateViewInfoPayload_OneOfFilterByTag = { - 2 : UpdateViewInfoPayload_OneOfFilter.filter, - 0 : UpdateViewInfoPayload_OneOfFilter.notSet - }; - static const $core.Map<$core.int, UpdateViewInfoPayload_OneOfGroup> _UpdateViewInfoPayload_OneOfGroupByTag = { - 3 : UpdateViewInfoPayload_OneOfGroup.group, - 0 : UpdateViewInfoPayload_OneOfGroup.notSet - }; - static const $core.Map<$core.int, UpdateViewInfoPayload_OneOfSort> _UpdateViewInfoPayload_OneOfSortByTag = { - 4 : UpdateViewInfoPayload_OneOfSort.sort, - 0 : UpdateViewInfoPayload_OneOfSort.notSet - }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateViewInfoPayload', createEmptyInstance: create) - ..oo(0, [2]) - ..oo(1, [3]) - ..oo(2, [4]) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewId') - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) - ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) - ..aOM(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) - ..hasRequiredFields = false - ; - - UpdateViewInfoPayload._() : super(); - factory UpdateViewInfoPayload({ - $core.String? viewId, - ViewFilter? filter, - ViewGroup? group, - ViewSort? sort, - }) { - final _result = create(); - if (viewId != null) { - _result.viewId = viewId; - } - if (filter != null) { - _result.filter = filter; - } - if (group != null) { - _result.group = group; - } - if (sort != null) { - _result.sort = sort; - } - return _result; - } - factory UpdateViewInfoPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory UpdateViewInfoPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - UpdateViewInfoPayload clone() => UpdateViewInfoPayload()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - UpdateViewInfoPayload copyWith(void Function(UpdateViewInfoPayload) updates) => super.copyWith((message) => updates(message as UpdateViewInfoPayload)) as UpdateViewInfoPayload; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static UpdateViewInfoPayload create() => UpdateViewInfoPayload._(); - UpdateViewInfoPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static UpdateViewInfoPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static UpdateViewInfoPayload? _defaultInstance; - - UpdateViewInfoPayload_OneOfFilter whichOneOfFilter() => _UpdateViewInfoPayload_OneOfFilterByTag[$_whichOneof(0)]!; - void clearOneOfFilter() => clearField($_whichOneof(0)); - - UpdateViewInfoPayload_OneOfGroup whichOneOfGroup() => _UpdateViewInfoPayload_OneOfGroupByTag[$_whichOneof(1)]!; - void clearOneOfGroup() => clearField($_whichOneof(1)); - - UpdateViewInfoPayload_OneOfSort whichOneOfSort() => _UpdateViewInfoPayload_OneOfSortByTag[$_whichOneof(2)]!; - void clearOneOfSort() => clearField($_whichOneof(2)); - - @$pb.TagNumber(1) - $core.String get viewId => $_getSZ(0); - @$pb.TagNumber(1) - set viewId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasViewId() => $_has(0); - @$pb.TagNumber(1) - void clearViewId() => clearField(1); - - @$pb.TagNumber(2) - ViewFilter get filter => $_getN(1); - @$pb.TagNumber(2) - set filter(ViewFilter v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasFilter() => $_has(1); - @$pb.TagNumber(2) - void clearFilter() => clearField(2); - @$pb.TagNumber(2) - ViewFilter ensureFilter() => $_ensure(1); - - @$pb.TagNumber(3) - ViewGroup get group => $_getN(2); - @$pb.TagNumber(3) - set group(ViewGroup v) { setField(3, v); } - @$pb.TagNumber(3) - $core.bool hasGroup() => $_has(2); - @$pb.TagNumber(3) - void clearGroup() => clearField(3); - @$pb.TagNumber(3) - ViewGroup ensureGroup() => $_ensure(2); - - @$pb.TagNumber(4) - ViewSort get sort => $_getN(3); - @$pb.TagNumber(4) - set sort(ViewSort v) { setField(4, v); } - @$pb.TagNumber(4) - $core.bool hasSort() => $_has(3); - @$pb.TagNumber(4) - void clearSort() => clearField(4); - @$pb.TagNumber(4) - ViewSort ensureSort() => $_ensure(3); } diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart index 679ba40e5c..b923c8e818 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder-data-model/view_info.pbjson.dart @@ -18,73 +18,9 @@ const ViewInfo$json = const { const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'}, const {'1': 'data_type', '3': 5, '4': 1, '5': 14, '6': '.ViewDataType', '10': 'dataType'}, const {'1': 'belongings', '3': 6, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'belongings'}, - const {'1': 'ext_data', '3': 7, '4': 1, '5': 11, '6': '.ViewExtData', '10': 'extData'}, + const {'1': 'ext_data', '3': 7, '4': 1, '5': 9, '10': 'extData'}, ], }; /// Descriptor for `ViewInfo`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewInfoDescriptor = $convert.base64Decode('CghWaWV3SW5mbxIOCgJpZBgBIAEoCVICaWQSIAoMYmVsb25nX3RvX2lkGAIgASgJUgpiZWxvbmdUb0lkEhIKBG5hbWUYAyABKAlSBG5hbWUSEgoEZGVzYxgEIAEoCVIEZGVzYxIqCglkYXRhX3R5cGUYBSABKA4yDS5WaWV3RGF0YVR5cGVSCGRhdGFUeXBlEi0KCmJlbG9uZ2luZ3MYBiABKAsyDS5SZXBlYXRlZFZpZXdSCmJlbG9uZ2luZ3MSJwoIZXh0X2RhdGEYByABKAsyDC5WaWV3RXh0RGF0YVIHZXh0RGF0YQ=='); -@$core.Deprecated('Use viewExtDataDescriptor instead') -const ViewExtData$json = const { - '1': 'ViewExtData', - '2': const [ - const {'1': 'filter', '3': 1, '4': 1, '5': 11, '6': '.ViewFilter', '10': 'filter'}, - const {'1': 'group', '3': 2, '4': 1, '5': 11, '6': '.ViewGroup', '10': 'group'}, - const {'1': 'sort', '3': 3, '4': 1, '5': 11, '6': '.ViewSort', '10': 'sort'}, - ], -}; - -/// Descriptor for `ViewExtData`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewExtDataDescriptor = $convert.base64Decode('CgtWaWV3RXh0RGF0YRIjCgZmaWx0ZXIYASABKAsyCy5WaWV3RmlsdGVyUgZmaWx0ZXISIAoFZ3JvdXAYAiABKAsyCi5WaWV3R3JvdXBSBWdyb3VwEh0KBHNvcnQYAyABKAsyCS5WaWV3U29ydFIEc29ydA=='); -@$core.Deprecated('Use viewFilterDescriptor instead') -const ViewFilter$json = const { - '1': 'ViewFilter', - '2': const [ - const {'1': 'object_id', '3': 1, '4': 1, '5': 9, '10': 'objectId'}, - ], -}; - -/// Descriptor for `ViewFilter`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewFilterDescriptor = $convert.base64Decode('CgpWaWV3RmlsdGVyEhsKCW9iamVjdF9pZBgBIAEoCVIIb2JqZWN0SWQ='); -@$core.Deprecated('Use viewGroupDescriptor instead') -const ViewGroup$json = const { - '1': 'ViewGroup', - '2': const [ - const {'1': 'group_object_id', '3': 1, '4': 1, '5': 9, '10': 'groupObjectId'}, - const {'1': 'sub_group_object_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'subGroupObjectId'}, - ], - '8': const [ - const {'1': 'one_of_sub_group_object_id'}, - ], -}; - -/// Descriptor for `ViewGroup`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewGroupDescriptor = $convert.base64Decode('CglWaWV3R3JvdXASJgoPZ3JvdXBfb2JqZWN0X2lkGAEgASgJUg1ncm91cE9iamVjdElkEi8KE3N1Yl9ncm91cF9vYmplY3RfaWQYAiABKAlIAFIQc3ViR3JvdXBPYmplY3RJZEIcChpvbmVfb2Zfc3ViX2dyb3VwX29iamVjdF9pZA=='); -@$core.Deprecated('Use viewSortDescriptor instead') -const ViewSort$json = const { - '1': 'ViewSort', - '2': const [ - const {'1': 'object_id', '3': 1, '4': 1, '5': 9, '10': 'objectId'}, - ], -}; - -/// Descriptor for `ViewSort`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List viewSortDescriptor = $convert.base64Decode('CghWaWV3U29ydBIbCglvYmplY3RfaWQYASABKAlSCG9iamVjdElk'); -@$core.Deprecated('Use updateViewInfoPayloadDescriptor instead') -const UpdateViewInfoPayload$json = const { - '1': 'UpdateViewInfoPayload', - '2': const [ - const {'1': 'view_id', '3': 1, '4': 1, '5': 9, '10': 'viewId'}, - const {'1': 'filter', '3': 2, '4': 1, '5': 11, '6': '.ViewFilter', '9': 0, '10': 'filter'}, - const {'1': 'group', '3': 3, '4': 1, '5': 11, '6': '.ViewGroup', '9': 1, '10': 'group'}, - const {'1': 'sort', '3': 4, '4': 1, '5': 11, '6': '.ViewSort', '9': 2, '10': 'sort'}, - ], - '8': const [ - const {'1': 'one_of_filter'}, - const {'1': 'one_of_group'}, - const {'1': 'one_of_sort'}, - ], -}; - -/// Descriptor for `UpdateViewInfoPayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List updateViewInfoPayloadDescriptor = $convert.base64Decode('ChVVcGRhdGVWaWV3SW5mb1BheWxvYWQSFwoHdmlld19pZBgBIAEoCVIGdmlld0lkEiUKBmZpbHRlchgCIAEoCzILLlZpZXdGaWx0ZXJIAFIGZmlsdGVyEiIKBWdyb3VwGAMgASgLMgouVmlld0dyb3VwSAFSBWdyb3VwEh8KBHNvcnQYBCABKAsyCS5WaWV3U29ydEgCUgRzb3J0Qg8KDW9uZV9vZl9maWx0ZXJCDgoMb25lX29mX2dyb3VwQg0KC29uZV9vZl9zb3J0'); +final $typed_data.Uint8List viewInfoDescriptor = $convert.base64Decode('CghWaWV3SW5mbxIOCgJpZBgBIAEoCVICaWQSIAoMYmVsb25nX3RvX2lkGAIgASgJUgpiZWxvbmdUb0lkEhIKBG5hbWUYAyABKAlSBG5hbWUSEgoEZGVzYxgEIAEoCVIEZGVzYxIqCglkYXRhX3R5cGUYBSABKA4yDS5WaWV3RGF0YVR5cGVSCGRhdGFUeXBlEi0KCmJlbG9uZ2luZ3MYBiABKAsyDS5SZXBlYXRlZFZpZXdSCmJlbG9uZ2luZ3MSGQoIZXh0X2RhdGEYByABKAlSB2V4dERhdGE='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart index 361ee9e10f..6df14e0a40 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbenum.dart @@ -27,7 +27,6 @@ class FolderEvent extends $pb.ProtobufEnum { static const FolderEvent DuplicateView = FolderEvent._(205, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DuplicateView'); static const FolderEvent CloseView = FolderEvent._(206, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CloseView'); static const FolderEvent ReadViewInfo = FolderEvent._(207, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ReadViewInfo'); - static const FolderEvent UpdateViewInfo = FolderEvent._(208, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateViewInfo'); static const FolderEvent CopyLink = FolderEvent._(220, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CopyLink'); static const FolderEvent SetLatestView = FolderEvent._(221, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SetLatestView'); static const FolderEvent MoveFolderItem = FolderEvent._(230, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MoveFolderItem'); @@ -55,7 +54,6 @@ class FolderEvent extends $pb.ProtobufEnum { DuplicateView, CloseView, ReadViewInfo, - UpdateViewInfo, CopyLink, SetLatestView, MoveFolderItem, diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart index 8167211b6e..ca9f0650fe 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-folder/event_map.pbjson.dart @@ -29,7 +29,6 @@ const FolderEvent$json = const { const {'1': 'DuplicateView', '2': 205}, const {'1': 'CloseView', '2': 206}, const {'1': 'ReadViewInfo', '2': 207}, - const {'1': 'UpdateViewInfo', '2': 208}, const {'1': 'CopyLink', '2': 220}, const {'1': 'SetLatestView', '2': 221}, const {'1': 'MoveFolderItem', '2': 230}, @@ -42,4 +41,4 @@ const FolderEvent$json = const { }; /// Descriptor for `FolderEvent`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARIOCglDbG9zZVZpZXcQzgESEQoMUmVhZFZpZXdJbmZvEM8BEhMKDlVwZGF0ZVZpZXdJbmZvENABEg0KCENvcHlMaW5rENwBEhIKDVNldExhdGVzdFZpZXcQ3QESEwoOTW92ZUZvbGRlckl0ZW0Q5gESDgoJUmVhZFRyYXNoEKwCEhEKDFB1dGJhY2tUcmFzaBCtAhIQCgtEZWxldGVUcmFzaBCuAhIUCg9SZXN0b3JlQWxsVHJhc2gQrwISEwoORGVsZXRlQWxsVHJhc2gQsAI='); +final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARIOCglDbG9zZVZpZXcQzgESEQoMUmVhZFZpZXdJbmZvEM8BEg0KCENvcHlMaW5rENwBEhIKDVNldExhdGVzdFZpZXcQ3QESEwoOTW92ZUZvbGRlckl0ZW0Q5gESDgoJUmVhZFRyYXNoEKwCEhEKDFB1dGJhY2tUcmFzaBCtAhIQCgtEZWxldGVUcmFzaBCuAhIUCg9SZXN0b3JlQWxsVHJhc2gQrwISEwoORGVsZXRlQWxsVHJhc2gQsAI='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pb.dart new file mode 100644 index 0000000000..6c586b82cb --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pb.dart @@ -0,0 +1,433 @@ +/// +// Generated code. Do not modify. +// source: grid_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class ViewExtData extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewExtData', createEmptyInstance: create) + ..aOM(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) + ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) + ..hasRequiredFields = false + ; + + ViewExtData._() : super(); + factory ViewExtData({ + ViewFilter? filter, + ViewGroup? group, + ViewSort? sort, + }) { + final _result = create(); + if (filter != null) { + _result.filter = filter; + } + if (group != null) { + _result.group = group; + } + if (sort != null) { + _result.sort = sort; + } + return _result; + } + factory ViewExtData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewExtData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewExtData clone() => ViewExtData()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewExtData copyWith(void Function(ViewExtData) updates) => super.copyWith((message) => updates(message as ViewExtData)) as ViewExtData; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewExtData create() => ViewExtData._(); + ViewExtData createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewExtData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewExtData? _defaultInstance; + + @$pb.TagNumber(1) + ViewFilter get filter => $_getN(0); + @$pb.TagNumber(1) + set filter(ViewFilter v) { setField(1, v); } + @$pb.TagNumber(1) + $core.bool hasFilter() => $_has(0); + @$pb.TagNumber(1) + void clearFilter() => clearField(1); + @$pb.TagNumber(1) + ViewFilter ensureFilter() => $_ensure(0); + + @$pb.TagNumber(2) + ViewGroup get group => $_getN(1); + @$pb.TagNumber(2) + set group(ViewGroup v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasGroup() => $_has(1); + @$pb.TagNumber(2) + void clearGroup() => clearField(2); + @$pb.TagNumber(2) + ViewGroup ensureGroup() => $_ensure(1); + + @$pb.TagNumber(3) + ViewSort get sort => $_getN(2); + @$pb.TagNumber(3) + set sort(ViewSort v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasSort() => $_has(2); + @$pb.TagNumber(3) + void clearSort() => clearField(3); + @$pb.TagNumber(3) + ViewSort ensureSort() => $_ensure(2); +} + +enum ViewFilter_OneOfFieldId { + fieldId, + notSet +} + +class ViewFilter extends $pb.GeneratedMessage { + static const $core.Map<$core.int, ViewFilter_OneOfFieldId> _ViewFilter_OneOfFieldIdByTag = { + 1 : ViewFilter_OneOfFieldId.fieldId, + 0 : ViewFilter_OneOfFieldId.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewFilter', createEmptyInstance: create) + ..oo(0, [1]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..hasRequiredFields = false + ; + + ViewFilter._() : super(); + factory ViewFilter({ + $core.String? fieldId, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + return _result; + } + factory ViewFilter.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewFilter.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewFilter clone() => ViewFilter()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewFilter copyWith(void Function(ViewFilter) updates) => super.copyWith((message) => updates(message as ViewFilter)) as ViewFilter; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewFilter create() => ViewFilter._(); + ViewFilter createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewFilter getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewFilter? _defaultInstance; + + ViewFilter_OneOfFieldId whichOneOfFieldId() => _ViewFilter_OneOfFieldIdByTag[$_whichOneof(0)]!; + void clearOneOfFieldId() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); +} + +enum ViewGroup_OneOfGroupFieldId { + groupFieldId, + notSet +} + +enum ViewGroup_OneOfSubGroupFieldId { + subGroupFieldId, + notSet +} + +class ViewGroup extends $pb.GeneratedMessage { + static const $core.Map<$core.int, ViewGroup_OneOfGroupFieldId> _ViewGroup_OneOfGroupFieldIdByTag = { + 1 : ViewGroup_OneOfGroupFieldId.groupFieldId, + 0 : ViewGroup_OneOfGroupFieldId.notSet + }; + static const $core.Map<$core.int, ViewGroup_OneOfSubGroupFieldId> _ViewGroup_OneOfSubGroupFieldIdByTag = { + 2 : ViewGroup_OneOfSubGroupFieldId.subGroupFieldId, + 0 : ViewGroup_OneOfSubGroupFieldId.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewGroup', createEmptyInstance: create) + ..oo(0, [1]) + ..oo(1, [2]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'groupFieldId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subGroupFieldId') + ..hasRequiredFields = false + ; + + ViewGroup._() : super(); + factory ViewGroup({ + $core.String? groupFieldId, + $core.String? subGroupFieldId, + }) { + final _result = create(); + if (groupFieldId != null) { + _result.groupFieldId = groupFieldId; + } + if (subGroupFieldId != null) { + _result.subGroupFieldId = subGroupFieldId; + } + return _result; + } + factory ViewGroup.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewGroup.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewGroup clone() => ViewGroup()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewGroup copyWith(void Function(ViewGroup) updates) => super.copyWith((message) => updates(message as ViewGroup)) as ViewGroup; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewGroup create() => ViewGroup._(); + ViewGroup createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewGroup getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewGroup? _defaultInstance; + + ViewGroup_OneOfGroupFieldId whichOneOfGroupFieldId() => _ViewGroup_OneOfGroupFieldIdByTag[$_whichOneof(0)]!; + void clearOneOfGroupFieldId() => clearField($_whichOneof(0)); + + ViewGroup_OneOfSubGroupFieldId whichOneOfSubGroupFieldId() => _ViewGroup_OneOfSubGroupFieldIdByTag[$_whichOneof(1)]!; + void clearOneOfSubGroupFieldId() => clearField($_whichOneof(1)); + + @$pb.TagNumber(1) + $core.String get groupFieldId => $_getSZ(0); + @$pb.TagNumber(1) + set groupFieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGroupFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearGroupFieldId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get subGroupFieldId => $_getSZ(1); + @$pb.TagNumber(2) + set subGroupFieldId($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasSubGroupFieldId() => $_has(1); + @$pb.TagNumber(2) + void clearSubGroupFieldId() => clearField(2); +} + +enum ViewSort_OneOfFieldId { + fieldId, + notSet +} + +class ViewSort extends $pb.GeneratedMessage { + static const $core.Map<$core.int, ViewSort_OneOfFieldId> _ViewSort_OneOfFieldIdByTag = { + 1 : ViewSort_OneOfFieldId.fieldId, + 0 : ViewSort_OneOfFieldId.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewSort', createEmptyInstance: create) + ..oo(0, [1]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..hasRequiredFields = false + ; + + ViewSort._() : super(); + factory ViewSort({ + $core.String? fieldId, + }) { + final _result = create(); + if (fieldId != null) { + _result.fieldId = fieldId; + } + return _result; + } + factory ViewSort.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ViewSort.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ViewSort clone() => ViewSort()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ViewSort copyWith(void Function(ViewSort) updates) => super.copyWith((message) => updates(message as ViewSort)) as ViewSort; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ViewSort create() => ViewSort._(); + ViewSort createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ViewSort getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ViewSort? _defaultInstance; + + ViewSort_OneOfFieldId whichOneOfFieldId() => _ViewSort_OneOfFieldIdByTag[$_whichOneof(0)]!; + void clearOneOfFieldId() => clearField($_whichOneof(0)); + + @$pb.TagNumber(1) + $core.String get fieldId => $_getSZ(0); + @$pb.TagNumber(1) + set fieldId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFieldId() => $_has(0); + @$pb.TagNumber(1) + void clearFieldId() => clearField(1); +} + +enum GridInfoChangesetPayload_OneOfFilter { + filter, + notSet +} + +enum GridInfoChangesetPayload_OneOfGroup { + group, + notSet +} + +enum GridInfoChangesetPayload_OneOfSort { + sort, + notSet +} + +class GridInfoChangesetPayload extends $pb.GeneratedMessage { + static const $core.Map<$core.int, GridInfoChangesetPayload_OneOfFilter> _GridInfoChangesetPayload_OneOfFilterByTag = { + 2 : GridInfoChangesetPayload_OneOfFilter.filter, + 0 : GridInfoChangesetPayload_OneOfFilter.notSet + }; + static const $core.Map<$core.int, GridInfoChangesetPayload_OneOfGroup> _GridInfoChangesetPayload_OneOfGroupByTag = { + 3 : GridInfoChangesetPayload_OneOfGroup.group, + 0 : GridInfoChangesetPayload_OneOfGroup.notSet + }; + static const $core.Map<$core.int, GridInfoChangesetPayload_OneOfSort> _GridInfoChangesetPayload_OneOfSortByTag = { + 4 : GridInfoChangesetPayload_OneOfSort.sort, + 0 : GridInfoChangesetPayload_OneOfSort.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridInfoChangesetPayload', createEmptyInstance: create) + ..oo(0, [2]) + ..oo(1, [3]) + ..oo(2, [4]) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') + ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'filter', subBuilder: ViewFilter.create) + ..aOM(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'group', subBuilder: ViewGroup.create) + ..aOM(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sort', subBuilder: ViewSort.create) + ..hasRequiredFields = false + ; + + GridInfoChangesetPayload._() : super(); + factory GridInfoChangesetPayload({ + $core.String? gridId, + ViewFilter? filter, + ViewGroup? group, + ViewSort? sort, + }) { + final _result = create(); + if (gridId != null) { + _result.gridId = gridId; + } + if (filter != null) { + _result.filter = filter; + } + if (group != null) { + _result.group = group; + } + if (sort != null) { + _result.sort = sort; + } + return _result; + } + factory GridInfoChangesetPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GridInfoChangesetPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GridInfoChangesetPayload clone() => GridInfoChangesetPayload()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GridInfoChangesetPayload copyWith(void Function(GridInfoChangesetPayload) updates) => super.copyWith((message) => updates(message as GridInfoChangesetPayload)) as GridInfoChangesetPayload; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static GridInfoChangesetPayload create() => GridInfoChangesetPayload._(); + GridInfoChangesetPayload createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GridInfoChangesetPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GridInfoChangesetPayload? _defaultInstance; + + GridInfoChangesetPayload_OneOfFilter whichOneOfFilter() => _GridInfoChangesetPayload_OneOfFilterByTag[$_whichOneof(0)]!; + void clearOneOfFilter() => clearField($_whichOneof(0)); + + GridInfoChangesetPayload_OneOfGroup whichOneOfGroup() => _GridInfoChangesetPayload_OneOfGroupByTag[$_whichOneof(1)]!; + void clearOneOfGroup() => clearField($_whichOneof(1)); + + GridInfoChangesetPayload_OneOfSort whichOneOfSort() => _GridInfoChangesetPayload_OneOfSortByTag[$_whichOneof(2)]!; + void clearOneOfSort() => clearField($_whichOneof(2)); + + @$pb.TagNumber(1) + $core.String get gridId => $_getSZ(0); + @$pb.TagNumber(1) + set gridId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasGridId() => $_has(0); + @$pb.TagNumber(1) + void clearGridId() => clearField(1); + + @$pb.TagNumber(2) + ViewFilter get filter => $_getN(1); + @$pb.TagNumber(2) + set filter(ViewFilter v) { setField(2, v); } + @$pb.TagNumber(2) + $core.bool hasFilter() => $_has(1); + @$pb.TagNumber(2) + void clearFilter() => clearField(2); + @$pb.TagNumber(2) + ViewFilter ensureFilter() => $_ensure(1); + + @$pb.TagNumber(3) + ViewGroup get group => $_getN(2); + @$pb.TagNumber(3) + set group(ViewGroup v) { setField(3, v); } + @$pb.TagNumber(3) + $core.bool hasGroup() => $_has(2); + @$pb.TagNumber(3) + void clearGroup() => clearField(3); + @$pb.TagNumber(3) + ViewGroup ensureGroup() => $_ensure(2); + + @$pb.TagNumber(4) + ViewSort get sort => $_getN(3); + @$pb.TagNumber(4) + set sort(ViewSort v) { setField(4, v); } + @$pb.TagNumber(4) + $core.bool hasSort() => $_has(3); + @$pb.TagNumber(4) + void clearSort() => clearField(4); + @$pb.TagNumber(4) + ViewSort ensureSort() => $_ensure(3); +} + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbenum.dart new file mode 100644 index 0000000000..e1566ef7de --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbenum.dart @@ -0,0 +1,7 @@ +/// +// Generated code. Do not modify. +// source: grid_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbjson.dart new file mode 100644 index 0000000000..c0f0448a24 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbjson.dart @@ -0,0 +1,81 @@ +/// +// Generated code. Do not modify. +// source: grid_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use viewExtDataDescriptor instead') +const ViewExtData$json = const { + '1': 'ViewExtData', + '2': const [ + const {'1': 'filter', '3': 1, '4': 1, '5': 11, '6': '.ViewFilter', '10': 'filter'}, + const {'1': 'group', '3': 2, '4': 1, '5': 11, '6': '.ViewGroup', '10': 'group'}, + const {'1': 'sort', '3': 3, '4': 1, '5': 11, '6': '.ViewSort', '10': 'sort'}, + ], +}; + +/// Descriptor for `ViewExtData`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewExtDataDescriptor = $convert.base64Decode('CgtWaWV3RXh0RGF0YRIjCgZmaWx0ZXIYASABKAsyCy5WaWV3RmlsdGVyUgZmaWx0ZXISIAoFZ3JvdXAYAiABKAsyCi5WaWV3R3JvdXBSBWdyb3VwEh0KBHNvcnQYAyABKAsyCS5WaWV3U29ydFIEc29ydA=='); +@$core.Deprecated('Use viewFilterDescriptor instead') +const ViewFilter$json = const { + '1': 'ViewFilter', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'fieldId'}, + ], + '8': const [ + const {'1': 'one_of_field_id'}, + ], +}; + +/// Descriptor for `ViewFilter`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewFilterDescriptor = $convert.base64Decode('CgpWaWV3RmlsdGVyEhsKCGZpZWxkX2lkGAEgASgJSABSB2ZpZWxkSWRCEQoPb25lX29mX2ZpZWxkX2lk'); +@$core.Deprecated('Use viewGroupDescriptor instead') +const ViewGroup$json = const { + '1': 'ViewGroup', + '2': const [ + const {'1': 'group_field_id', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'groupFieldId'}, + const {'1': 'sub_group_field_id', '3': 2, '4': 1, '5': 9, '9': 1, '10': 'subGroupFieldId'}, + ], + '8': const [ + const {'1': 'one_of_group_field_id'}, + const {'1': 'one_of_sub_group_field_id'}, + ], +}; + +/// Descriptor for `ViewGroup`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewGroupDescriptor = $convert.base64Decode('CglWaWV3R3JvdXASJgoOZ3JvdXBfZmllbGRfaWQYASABKAlIAFIMZ3JvdXBGaWVsZElkEi0KEnN1Yl9ncm91cF9maWVsZF9pZBgCIAEoCUgBUg9zdWJHcm91cEZpZWxkSWRCFwoVb25lX29mX2dyb3VwX2ZpZWxkX2lkQhsKGW9uZV9vZl9zdWJfZ3JvdXBfZmllbGRfaWQ='); +@$core.Deprecated('Use viewSortDescriptor instead') +const ViewSort$json = const { + '1': 'ViewSort', + '2': const [ + const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'fieldId'}, + ], + '8': const [ + const {'1': 'one_of_field_id'}, + ], +}; + +/// Descriptor for `ViewSort`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List viewSortDescriptor = $convert.base64Decode('CghWaWV3U29ydBIbCghmaWVsZF9pZBgBIAEoCUgAUgdmaWVsZElkQhEKD29uZV9vZl9maWVsZF9pZA=='); +@$core.Deprecated('Use gridInfoChangesetPayloadDescriptor instead') +const GridInfoChangesetPayload$json = const { + '1': 'GridInfoChangesetPayload', + '2': const [ + const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'}, + const {'1': 'filter', '3': 2, '4': 1, '5': 11, '6': '.ViewFilter', '9': 0, '10': 'filter'}, + const {'1': 'group', '3': 3, '4': 1, '5': 11, '6': '.ViewGroup', '9': 1, '10': 'group'}, + const {'1': 'sort', '3': 4, '4': 1, '5': 11, '6': '.ViewSort', '9': 2, '10': 'sort'}, + ], + '8': const [ + const {'1': 'one_of_filter'}, + const {'1': 'one_of_group'}, + const {'1': 'one_of_sort'}, + ], +}; + +/// Descriptor for `GridInfoChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List gridInfoChangesetPayloadDescriptor = $convert.base64Decode('ChhHcmlkSW5mb0NoYW5nZXNldFBheWxvYWQSFwoHZ3JpZF9pZBgBIAEoCVIGZ3JpZElkEiUKBmZpbHRlchgCIAEoCzILLlZpZXdGaWx0ZXJIAFIGZmlsdGVyEiIKBWdyb3VwGAMgASgLMgouVmlld0dyb3VwSAFSBWdyb3VwEh8KBHNvcnQYBCABKAsyCS5WaWV3U29ydEgCUgRzb3J0Qg8KDW9uZV9vZl9maWx0ZXJCDgoMb25lX29mX2dyb3VwQg0KC29uZV9vZl9zb3J0'); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbserver.dart new file mode 100644 index 0000000000..a01a5caa50 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid_info.pbserver.dart @@ -0,0 +1,9 @@ +/// +// Generated code. Do not modify. +// source: grid_info.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +export 'grid_info.pb.dart'; + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart index 44798a9231..bcede37639 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/protobuf.dart @@ -1,3 +1,4 @@ // Auto-generated, do not edit export './grid.pb.dart'; +export './grid_info.pb.dart'; export './field.pb.dart'; diff --git a/frontend/rust-lib/flowy-folder/src/event_map.rs b/frontend/rust-lib/flowy-folder/src/event_map.rs index 8caf43c9c0..abb168b5e3 100644 --- a/frontend/rust-lib/flowy-folder/src/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/event_map.rs @@ -64,7 +64,6 @@ pub fn create(folder: Arc) -> Module { .event(FolderEvent::ReadView, read_view_handler) .event(FolderEvent::UpdateView, update_view_handler) .event(FolderEvent::ReadViewInfo, read_view_info_handler) - .event(FolderEvent::UpdateViewInfo, update_view_info_handler) .event(FolderEvent::DeleteView, delete_view_handler) .event(FolderEvent::DuplicateView, duplicate_view_handler) .event(FolderEvent::SetLatestView, set_latest_view_handler) @@ -136,9 +135,6 @@ pub enum FolderEvent { #[event(input = "ViewId", output = "ViewInfo")] ReadViewInfo = 207, - #[event(input = "UpdateViewInfoPayload", output = "ViewInfo")] - UpdateViewInfo = 208, - #[event()] CopyLink = 220, diff --git a/frontend/rust-lib/flowy-folder/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rs index 8f5f318f95..f2b871475d 100644 --- a/frontend/rust-lib/flowy-folder/src/manager.rs +++ b/frontend/rust-lib/flowy-folder/src/manager.rs @@ -9,15 +9,12 @@ use crate::{ }, }; use bytes::Bytes; -use flowy_sync::client_document::default::{initial_quill_delta_string, initial_read_me}; - use flowy_error::FlowyError; use flowy_folder_data_model::entities::view::ViewDataType; - -use flowy_folder_data_model::entities::UpdateViewInfoParams; use flowy_folder_data_model::user_default; use flowy_revision::disk::SQLiteTextBlockRevisionPersistence; use flowy_revision::{RevisionManager, RevisionPersistence, RevisionWebSocket}; +use flowy_sync::client_document::default::{initial_quill_delta_string, initial_read_me}; use flowy_sync::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData}; use lazy_static::lazy_static; use lib_infra::future::FutureResult; @@ -256,8 +253,6 @@ pub trait ViewDataProcessor { data: Vec, ) -> FutureResult; - fn handle_view_info_updated(&self, params: UpdateViewInfoParams) -> FutureResult<(), FlowyError>; - fn data_type(&self) -> ViewDataType; } diff --git a/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs b/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs index ea19aa93df..6cfa810ab9 100644 --- a/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs +++ b/frontend/rust-lib/flowy-folder/src/protobuf/model/event_map.rs @@ -42,7 +42,6 @@ pub enum FolderEvent { DuplicateView = 205, CloseView = 206, ReadViewInfo = 207, - UpdateViewInfo = 208, CopyLink = 220, SetLatestView = 221, MoveFolderItem = 230, @@ -77,7 +76,6 @@ impl ::protobuf::ProtobufEnum for FolderEvent { 205 => ::std::option::Option::Some(FolderEvent::DuplicateView), 206 => ::std::option::Option::Some(FolderEvent::CloseView), 207 => ::std::option::Option::Some(FolderEvent::ReadViewInfo), - 208 => ::std::option::Option::Some(FolderEvent::UpdateViewInfo), 220 => ::std::option::Option::Some(FolderEvent::CopyLink), 221 => ::std::option::Option::Some(FolderEvent::SetLatestView), 230 => ::std::option::Option::Some(FolderEvent::MoveFolderItem), @@ -109,7 +107,6 @@ impl ::protobuf::ProtobufEnum for FolderEvent { FolderEvent::DuplicateView, FolderEvent::CloseView, FolderEvent::ReadViewInfo, - FolderEvent::UpdateViewInfo, FolderEvent::CopyLink, FolderEvent::SetLatestView, FolderEvent::MoveFolderItem, @@ -146,7 +143,7 @@ impl ::protobuf::reflect::ProtobufValue for FolderEvent { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0fevent_map.proto*\xeb\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\ + \n\x0fevent_map.proto*\xd6\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\ pace\x10\0\x12\x14\n\x10ReadCurWorkspace\x10\x01\x12\x12\n\x0eReadWorksp\ aces\x10\x02\x12\x13\n\x0fDeleteWorkspace\x10\x03\x12\x11\n\rOpenWorkspa\ ce\x10\x04\x12\x15\n\x11ReadWorkspaceApps\x10\x05\x12\r\n\tCreateApp\x10\ @@ -154,12 +151,11 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x10h\x12\x0f\n\nCreateView\x10\xc9\x01\x12\r\n\x08ReadView\x10\xca\x01\ \x12\x0f\n\nUpdateView\x10\xcb\x01\x12\x0f\n\nDeleteView\x10\xcc\x01\x12\ \x12\n\rDuplicateView\x10\xcd\x01\x12\x0e\n\tCloseView\x10\xce\x01\x12\ - \x11\n\x0cReadViewInfo\x10\xcf\x01\x12\x13\n\x0eUpdateViewInfo\x10\xd0\ - \x01\x12\r\n\x08CopyLink\x10\xdc\x01\x12\x12\n\rSetLatestView\x10\xdd\ - \x01\x12\x13\n\x0eMoveFolderItem\x10\xe6\x01\x12\x0e\n\tReadTrash\x10\ - \xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\x02\x12\x10\n\x0bDeleteTrash\ - \x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\x10\xaf\x02\x12\x13\n\x0eDelet\ - eAllTrash\x10\xb0\x02b\x06proto3\ + \x11\n\x0cReadViewInfo\x10\xcf\x01\x12\r\n\x08CopyLink\x10\xdc\x01\x12\ + \x12\n\rSetLatestView\x10\xdd\x01\x12\x13\n\x0eMoveFolderItem\x10\xe6\ + \x01\x12\x0e\n\tReadTrash\x10\xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\ + \x02\x12\x10\n\x0bDeleteTrash\x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\ + \x10\xaf\x02\x12\x13\n\x0eDeleteAllTrash\x10\xb0\x02b\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto b/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto index db714c9ce7..bb11f02509 100644 --- a/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto +++ b/frontend/rust-lib/flowy-folder/src/protobuf/proto/event_map.proto @@ -18,7 +18,6 @@ enum FolderEvent { DuplicateView = 205; CloseView = 206; ReadViewInfo = 207; - UpdateViewInfo = 208; CopyLink = 220; SetLatestView = 221; MoveFolderItem = 230; diff --git a/frontend/rust-lib/flowy-folder/src/services/folder_editor.rs b/frontend/rust-lib/flowy-folder/src/services/folder_editor.rs index ef94c1d316..4fa40013d0 100644 --- a/frontend/rust-lib/flowy-folder/src/services/folder_editor.rs +++ b/frontend/rust-lib/flowy-folder/src/services/folder_editor.rs @@ -1,16 +1,14 @@ -use flowy_sync::{ - client_folder::{FolderChange, FolderPad}, - entities::{revision::Revision, ws_data::ServerRevisionWSData}, -}; - use crate::manager::FolderId; use bytes::Bytes; use flowy_error::{FlowyError, FlowyResult}; -use flowy_sync::util::make_delta_from_revisions; - use flowy_revision::{ RevisionCloudService, RevisionCompactor, RevisionManager, RevisionObjectBuilder, RevisionWebSocket, }; +use flowy_sync::util::make_delta_from_revisions; +use flowy_sync::{ + client_folder::{FolderChange, FolderPad}, + entities::{revision::Revision, ws_data::ServerRevisionWSData}, +}; use lib_infra::future::FutureResult; use lib_ot::core::PlainTextAttributes; diff --git a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs index 88b36dd19b..d51c1c1235 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs @@ -15,7 +15,7 @@ use crate::{ use bytes::Bytes; use flowy_database::kv::KV; use flowy_folder_data_model::entities::view::{gen_view_id, ViewDataType}; -use flowy_folder_data_model::entities::{UpdateViewInfoParams, ViewExtData, ViewInfo}; +use flowy_folder_data_model::entities::ViewInfo; use flowy_folder_data_model::revision::ViewRevision; use flowy_sync::entities::text_block_info::TextBlockId; use futures::{FutureExt, StreamExt}; @@ -135,7 +135,6 @@ impl ViewController { .map(|view_rev| view_rev.into()) .collect(); - let ext_data = ViewExtData::from(view_rev.ext_data); let view_info = ViewInfo { id: view_rev.id, belong_to_id: view_rev.belong_to_id, @@ -143,7 +142,7 @@ impl ViewController { desc: view_rev.desc, data_type: view_rev.data_type, belongings: RepeatedView { items }, - ext_data, + ext_data: view_rev.ext_data, }; Ok(view_info) }) @@ -259,11 +258,6 @@ impl ViewController { Ok(view_rev) } - #[tracing::instrument(level = "debug", skip(self, _params), err)] - pub(crate) async fn update_view_info(&self, _params: UpdateViewInfoParams) -> Result<(), FlowyError> { - todo!() - } - pub(crate) async fn latest_visit_view(&self) -> FlowyResult> { match KV::get_str(LATEST_VIEW_ID) { None => Ok(None), diff --git a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs index 691f3fb058..cfacc23e0e 100644 --- a/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/services/view/event_handler.rs @@ -11,7 +11,7 @@ use crate::{ services::{TrashController, ViewController}, }; use flowy_folder_data_model::entities::view::{MoveFolderItemParams, MoveFolderItemPayload, MoveFolderItemType}; -use flowy_folder_data_model::entities::{UpdateViewInfoParams, UpdateViewInfoPayload, ViewInfo}; +use flowy_folder_data_model::entities::ViewInfo; use flowy_folder_data_model::revision::TrashRevision; use lib_dispatch::prelude::{data_result, AppData, Data, DataResult}; use std::{convert::TryInto, sync::Arc}; @@ -54,17 +54,6 @@ pub(crate) async fn update_view_handler( Ok(()) } -#[tracing::instrument(level = "debug", skip(data, controller), err)] -pub(crate) async fn update_view_info_handler( - data: Data, - controller: AppData>, -) -> Result<(), FlowyError> { - let params: UpdateViewInfoParams = data.into_inner().try_into()?; - let _ = controller.update_view_info(params).await?; - - Ok(()) -} - pub(crate) async fn delete_view_handler( data: Data, view_controller: AppData>, diff --git a/frontend/rust-lib/flowy-grid/src/manager.rs b/frontend/rust-lib/flowy-grid/src/manager.rs index 2b388677c4..12ebd1b74a 100644 --- a/frontend/rust-lib/flowy-grid/src/manager.rs +++ b/frontend/rust-lib/flowy-grid/src/manager.rs @@ -6,7 +6,7 @@ use bytes::Bytes; use dashmap::DashMap; use flowy_database::ConnectionPool; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::revision::{BuildGridContext, GridRevision}; +use flowy_grid_data_model::revision::{BuildGridContext, GridInfoRevision, GridRevision}; use flowy_revision::disk::{SQLiteGridBlockMetaRevisionPersistence, SQLiteGridRevisionPersistence}; use flowy_revision::{RevisionManager, RevisionPersistence, RevisionWebSocket}; use flowy_sync::client_grid::{make_block_meta_delta, make_grid_delta}; @@ -160,6 +160,7 @@ pub async fn make_grid_view_data( grid_id: view_id.to_string(), fields: build_context.field_revs, blocks: build_context.blocks, + info: GridInfoRevision::default(), }; // Create grid diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs index d20956a985..22e73b2ad4 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs @@ -45,7 +45,7 @@ impl CellDataOperation for CheckboxTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - field_rev: &FieldRevision, + _field_rev: &FieldRevision, ) -> FlowyResult where T: Into, diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs index 2a5ffaf1cd..9dcf88e2aa 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs @@ -120,7 +120,7 @@ impl CellDataOperation for DateTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - field_rev: &FieldRevision, + _field_rev: &FieldRevision, ) -> FlowyResult where T: Into, diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs index 72a15f1949..6a7600f8fb 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs @@ -144,7 +144,7 @@ impl CellDataOperation for NumberTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - field_rev: &FieldRevision, + _field_rev: &FieldRevision, ) -> FlowyResult where T: Into, diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs index 5bbcdc513c..9988a60864 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs @@ -99,7 +99,7 @@ impl CellDataOperation for SingleSelectTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - field_rev: &FieldRevision, + _field_rev: &FieldRevision, ) -> FlowyResult where T: Into, @@ -197,7 +197,7 @@ impl CellDataOperation for MultiSelectTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - field_rev: &FieldRevision, + _field_rev: &FieldRevision, ) -> FlowyResult where T: Into, diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs index f5db6dcffb..eef90655c2 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs @@ -38,7 +38,7 @@ impl CellDataOperation> for URLTypeOption { &self, encoded_data: T, decoded_field_type: &FieldType, - field_rev: &FieldRevision, + _field_rev: &FieldRevision, ) -> FlowyResult where T: Into>, diff --git a/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs b/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs index 5b2aaf9560..a4f30ca1c2 100644 --- a/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs +++ b/frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs @@ -24,10 +24,7 @@ impl<'a> CreateRowMetaBuilder<'a> { visibility: true, }; - Self { - field_rev_map: field_rev_map, - payload, - } + Self { field_rev_map, payload } } pub fn add_cell(&mut self, field_id: &str, data: String) -> FlowyResult<()> { diff --git a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs index bf1757e021..3cee5cf60a 100644 --- a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs +++ b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs @@ -1,6 +1,5 @@ use bytes::Bytes; use flowy_database::ConnectionPool; -use flowy_folder::entities::UpdateViewInfoParams; use flowy_folder::manager::{ViewDataProcessor, ViewDataProcessorMap}; use flowy_folder::prelude::ViewDataType; use flowy_folder::{ @@ -204,11 +203,6 @@ impl ViewDataProcessor for TextBlockViewDataProcessor { FutureResult::new(async move { Ok(Bytes::from(data)) }) } - fn handle_view_info_updated(&self, _params: UpdateViewInfoParams) -> FutureResult<(), FlowyError> { - tracing::warn!("Unimplemented the handle_view_info_updated in TextBlock"); - FutureResult::new(async { Ok(()) }) - } - fn data_type(&self) -> ViewDataType { ViewDataType::TextBlock } @@ -284,10 +278,6 @@ impl ViewDataProcessor for GridViewDataProcessor { }) } - fn handle_view_info_updated(&self, params: UpdateViewInfoParams) -> FutureResult<(), FlowyError> { - todo!() - } - fn data_type(&self) -> ViewDataType { ViewDataType::Grid } diff --git a/shared-lib/flowy-folder-data-model/src/entities/view_info.rs b/shared-lib/flowy-folder-data-model/src/entities/view_info.rs index a4f0fd8645..a772396e9f 100644 --- a/shared-lib/flowy-folder-data-model/src/entities/view_info.rs +++ b/shared-lib/flowy-folder-data-model/src/entities/view_info.rs @@ -1,9 +1,5 @@ use crate::entities::{RepeatedView, ViewDataType}; -use crate::parser::view::ViewIdentify; -use crate::parser::view_info::{ViewFilterParser, ViewGroupParser, ViewSortParser}; use flowy_derive::ProtoBuf; -use flowy_error_code::ErrorCode; -use std::convert::TryInto; #[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] pub struct ViewInfo { @@ -26,90 +22,5 @@ pub struct ViewInfo { pub belongings: RepeatedView, #[pb(index = 7)] - pub ext_data: ViewExtData, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewExtData { - #[pb(index = 1)] - pub filter: ViewFilter, - - #[pb(index = 2)] - pub group: ViewGroup, - - #[pb(index = 3)] - pub sort: ViewSort, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewFilter { - #[pb(index = 1)] - pub object_id: String, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewGroup { - #[pb(index = 1)] - pub group_object_id: String, - - #[pb(index = 2, one_of)] - pub sub_group_object_id: Option, -} - -#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] -pub struct ViewSort { - #[pb(index = 1)] - pub object_id: String, -} - -#[derive(Default, ProtoBuf)] -pub struct UpdateViewInfoPayload { - #[pb(index = 1)] - pub view_id: String, - - #[pb(index = 2, one_of)] - pub filter: Option, - - #[pb(index = 3, one_of)] - pub group: Option, - - #[pb(index = 4, one_of)] - pub sort: Option, -} - -pub struct UpdateViewInfoParams { - pub view_id: String, - pub filter: Option, - pub group: Option, - pub sort: Option, -} - -impl TryInto for UpdateViewInfoPayload { - type Error = ErrorCode; - - fn try_into(self) -> Result { - let view_id = ViewIdentify::parse(self.view_id)?.0; - - let filter = match self.filter { - None => None, - Some(filter) => Some(ViewFilterParser::parse(filter)?), - }; - - let group = match self.group { - None => None, - Some(group) => Some(ViewGroupParser::parse(group)?), - }; - - let sort = match self.sort { - None => None, - Some(sort) => Some(ViewSortParser::parse(sort)?), - }; - - Ok(UpdateViewInfoParams { - view_id, - filter, - group, - sort, - }) - } + pub ext_data: String, } diff --git a/shared-lib/flowy-folder-data-model/src/parser/mod.rs b/shared-lib/flowy-folder-data-model/src/parser/mod.rs index 5f16ba6b38..3ee0f4b591 100644 --- a/shared-lib/flowy-folder-data-model/src/parser/mod.rs +++ b/shared-lib/flowy-folder-data-model/src/parser/mod.rs @@ -1,5 +1,4 @@ pub mod app; pub mod trash; pub mod view; -pub mod view_info; pub mod workspace; diff --git a/shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs b/shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs deleted file mode 100644 index fc7202c4cb..0000000000 --- a/shared-lib/flowy-folder-data-model/src/parser/view_info/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod object_id; -mod view_ext; - -pub use object_id::*; -pub use view_ext::*; diff --git a/shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs b/shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs deleted file mode 100644 index 155dea5fa8..0000000000 --- a/shared-lib/flowy-folder-data-model/src/parser/view_info/object_id.rs +++ /dev/null @@ -1,19 +0,0 @@ -use crate::errors::ErrorCode; - -#[derive(Debug)] -pub struct ObjectId(pub String); - -impl ObjectId { - pub fn parse(s: String) -> Result { - if s.trim().is_empty() { - return Err(ErrorCode::UnexpectedEmptyString); - } - Ok(Self(s)) - } -} - -impl AsRef for ObjectId { - fn as_ref(&self) -> &str { - &self.0 - } -} diff --git a/shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs b/shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs deleted file mode 100644 index 80d1d56f51..0000000000 --- a/shared-lib/flowy-folder-data-model/src/parser/view_info/view_ext.rs +++ /dev/null @@ -1,40 +0,0 @@ -use crate::entities::{ViewFilter, ViewGroup, ViewSort}; -use crate::errors::ErrorCode; -use crate::parser::view_info::ObjectId; - -pub struct ViewFilterParser(pub ViewFilter); - -impl ViewFilterParser { - pub fn parse(value: ViewFilter) -> Result { - let object_id = ObjectId::parse(value.object_id)?.0; - Ok(ViewFilter { object_id }) - } -} - -pub struct ViewGroupParser(pub ViewGroup); - -impl ViewGroupParser { - pub fn parse(value: ViewGroup) -> Result { - let group_object_id = ObjectId::parse(value.group_object_id)?.0; - - let sub_group_object_id = match value.sub_group_object_id { - None => None, - Some(object_id) => Some(ObjectId::parse(object_id)?.0), - }; - - Ok(ViewGroup { - group_object_id, - sub_group_object_id, - }) - } -} - -pub struct ViewSortParser(pub ViewSort); - -impl ViewSortParser { - pub fn parse(value: ViewSort) -> Result { - let object_id = ObjectId::parse(value.object_id)?.0; - - Ok(ViewSort { object_id }) - } -} diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs b/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs index 162effd9af..d0c9137718 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs +++ b/shared-lib/flowy-folder-data-model/src/protobuf/model/view_info.rs @@ -32,7 +32,7 @@ pub struct ViewInfo { pub desc: ::std::string::String, pub data_type: super::view::ViewDataType, pub belongings: ::protobuf::SingularPtrField, - pub ext_data: ::protobuf::SingularPtrField, + pub ext_data: ::std::string::String, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, @@ -201,37 +201,30 @@ impl ViewInfo { self.belongings.take().unwrap_or_else(|| super::view::RepeatedView::new()) } - // .ViewExtData ext_data = 7; + // string ext_data = 7; - pub fn get_ext_data(&self) -> &ViewExtData { - self.ext_data.as_ref().unwrap_or_else(|| ::default_instance()) + pub fn get_ext_data(&self) -> &str { + &self.ext_data } pub fn clear_ext_data(&mut self) { self.ext_data.clear(); } - pub fn has_ext_data(&self) -> bool { - self.ext_data.is_some() - } - // Param is passed by value, moved - pub fn set_ext_data(&mut self, v: ViewExtData) { - self.ext_data = ::protobuf::SingularPtrField::some(v); + pub fn set_ext_data(&mut self, v: ::std::string::String) { + self.ext_data = v; } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_ext_data(&mut self) -> &mut ViewExtData { - if self.ext_data.is_none() { - self.ext_data.set_default(); - } - self.ext_data.as_mut().unwrap() + pub fn mut_ext_data(&mut self) -> &mut ::std::string::String { + &mut self.ext_data } // Take field - pub fn take_ext_data(&mut self) -> ViewExtData { - self.ext_data.take().unwrap_or_else(|| ViewExtData::new()) + pub fn take_ext_data(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.ext_data, ::std::string::String::new()) } } @@ -242,11 +235,6 @@ impl ::protobuf::Message for ViewInfo { return false; } }; - for v in &self.ext_data { - if !v.is_initialized() { - return false; - } - }; true } @@ -273,7 +261,7 @@ impl ::protobuf::Message for ViewInfo { ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.belongings)?; }, 7 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.ext_data)?; + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.ext_data)?; }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -306,9 +294,8 @@ impl ::protobuf::Message for ViewInfo { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; } - if let Some(ref v) = self.ext_data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + if !self.ext_data.is_empty() { + my_size += ::protobuf::rt::string_size(7, &self.ext_data); } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); @@ -336,10 +323,8 @@ impl ::protobuf::Message for ViewInfo { os.write_raw_varint32(v.get_cached_size())?; v.write_to_with_cached_sizes(os)?; } - if let Some(ref v) = self.ext_data.as_ref() { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; + if !self.ext_data.is_empty() { + os.write_string(7, &self.ext_data)?; } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) @@ -409,7 +394,7 @@ impl ::protobuf::Message for ViewInfo { |m: &ViewInfo| { &m.belongings }, |m: &mut ViewInfo| { &mut m.belongings }, )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "ext_data", |m: &ViewInfo| { &m.ext_data }, |m: &mut ViewInfo| { &mut m.ext_data }, @@ -453,1301 +438,14 @@ impl ::protobuf::reflect::ProtobufValue for ViewInfo { } } -#[derive(PartialEq,Clone,Default)] -pub struct ViewExtData { - // message fields - pub filter: ::protobuf::SingularPtrField, - pub group: ::protobuf::SingularPtrField, - pub sort: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewExtData { - fn default() -> &'a ViewExtData { - ::default_instance() - } -} - -impl ViewExtData { - pub fn new() -> ViewExtData { - ::std::default::Default::default() - } - - // .ViewFilter filter = 1; - - - pub fn get_filter(&self) -> &ViewFilter { - self.filter.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_filter(&mut self) { - self.filter.clear(); - } - - pub fn has_filter(&self) -> bool { - self.filter.is_some() - } - - // Param is passed by value, moved - pub fn set_filter(&mut self, v: ViewFilter) { - self.filter = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_filter(&mut self) -> &mut ViewFilter { - if self.filter.is_none() { - self.filter.set_default(); - } - self.filter.as_mut().unwrap() - } - - // Take field - pub fn take_filter(&mut self) -> ViewFilter { - self.filter.take().unwrap_or_else(|| ViewFilter::new()) - } - - // .ViewGroup group = 2; - - - pub fn get_group(&self) -> &ViewGroup { - self.group.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_group(&mut self) { - self.group.clear(); - } - - pub fn has_group(&self) -> bool { - self.group.is_some() - } - - // Param is passed by value, moved - pub fn set_group(&mut self, v: ViewGroup) { - self.group = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_group(&mut self) -> &mut ViewGroup { - if self.group.is_none() { - self.group.set_default(); - } - self.group.as_mut().unwrap() - } - - // Take field - pub fn take_group(&mut self) -> ViewGroup { - self.group.take().unwrap_or_else(|| ViewGroup::new()) - } - - // .ViewSort sort = 3; - - - pub fn get_sort(&self) -> &ViewSort { - self.sort.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_sort(&mut self) { - self.sort.clear(); - } - - pub fn has_sort(&self) -> bool { - self.sort.is_some() - } - - // Param is passed by value, moved - pub fn set_sort(&mut self, v: ViewSort) { - self.sort = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sort(&mut self) -> &mut ViewSort { - if self.sort.is_none() { - self.sort.set_default(); - } - self.sort.as_mut().unwrap() - } - - // Take field - pub fn take_sort(&mut self) -> ViewSort { - self.sort.take().unwrap_or_else(|| ViewSort::new()) - } -} - -impl ::protobuf::Message for ViewExtData { - fn is_initialized(&self) -> bool { - for v in &self.filter { - if !v.is_initialized() { - return false; - } - }; - for v in &self.group { - if !v.is_initialized() { - return false; - } - }; - for v in &self.sort { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.filter)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.group)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.sort)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.filter.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.group.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.sort.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.filter.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.group.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.sort.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewExtData { - ViewExtData::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "filter", - |m: &ViewExtData| { &m.filter }, - |m: &mut ViewExtData| { &mut m.filter }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "group", - |m: &ViewExtData| { &m.group }, - |m: &mut ViewExtData| { &mut m.group }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "sort", - |m: &ViewExtData| { &m.sort }, - |m: &mut ViewExtData| { &mut m.sort }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewExtData", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewExtData { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewExtData::new) - } -} - -impl ::protobuf::Clear for ViewExtData { - fn clear(&mut self) { - self.filter.clear(); - self.group.clear(); - self.sort.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewExtData { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewExtData { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ViewFilter { - // message fields - pub object_id: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewFilter { - fn default() -> &'a ViewFilter { - ::default_instance() - } -} - -impl ViewFilter { - pub fn new() -> ViewFilter { - ::std::default::Default::default() - } - - // string object_id = 1; - - - pub fn get_object_id(&self) -> &str { - &self.object_id - } - pub fn clear_object_id(&mut self) { - self.object_id.clear(); - } - - // Param is passed by value, moved - pub fn set_object_id(&mut self, v: ::std::string::String) { - self.object_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_object_id(&mut self) -> &mut ::std::string::String { - &mut self.object_id - } - - // Take field - pub fn take_object_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.object_id, ::std::string::String::new()) - } -} - -impl ::protobuf::Message for ViewFilter { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.object_id)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.object_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.object_id); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.object_id.is_empty() { - os.write_string(1, &self.object_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewFilter { - ViewFilter::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "object_id", - |m: &ViewFilter| { &m.object_id }, - |m: &mut ViewFilter| { &mut m.object_id }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewFilter", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewFilter { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewFilter::new) - } -} - -impl ::protobuf::Clear for ViewFilter { - fn clear(&mut self) { - self.object_id.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewFilter { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewFilter { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ViewGroup { - // message fields - pub group_object_id: ::std::string::String, - // message oneof groups - pub one_of_sub_group_object_id: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewGroup { - fn default() -> &'a ViewGroup { - ::default_instance() - } -} - -#[derive(Clone,PartialEq,Debug)] -pub enum ViewGroup_oneof_one_of_sub_group_object_id { - sub_group_object_id(::std::string::String), -} - -impl ViewGroup { - pub fn new() -> ViewGroup { - ::std::default::Default::default() - } - - // string group_object_id = 1; - - - pub fn get_group_object_id(&self) -> &str { - &self.group_object_id - } - pub fn clear_group_object_id(&mut self) { - self.group_object_id.clear(); - } - - // Param is passed by value, moved - pub fn set_group_object_id(&mut self, v: ::std::string::String) { - self.group_object_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_group_object_id(&mut self) -> &mut ::std::string::String { - &mut self.group_object_id - } - - // Take field - pub fn take_group_object_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.group_object_id, ::std::string::String::new()) - } - - // string sub_group_object_id = 2; - - - pub fn get_sub_group_object_id(&self) -> &str { - match self.one_of_sub_group_object_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref v)) => v, - _ => "", - } - } - pub fn clear_sub_group_object_id(&mut self) { - self.one_of_sub_group_object_id = ::std::option::Option::None; - } - - pub fn has_sub_group_object_id(&self) -> bool { - match self.one_of_sub_group_object_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_sub_group_object_id(&mut self, v: ::std::string::String) { - self.one_of_sub_group_object_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(v)) - } - - // Mutable pointer to the field. - pub fn mut_sub_group_object_id(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(_)) = self.one_of_sub_group_object_id { - } else { - self.one_of_sub_group_object_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(::std::string::String::new())); - } - match self.one_of_sub_group_object_id { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_sub_group_object_id(&mut self) -> ::std::string::String { - if self.has_sub_group_object_id() { - match self.one_of_sub_group_object_id.take() { - ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } -} - -impl ::protobuf::Message for ViewGroup { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.group_object_id)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_sub_group_object_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(is.read_string()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.group_object_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.group_object_id); - } - if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_object_id { - match v { - &ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref v) => { - my_size += ::protobuf::rt::string_size(2, &v); - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.group_object_id.is_empty() { - os.write_string(1, &self.group_object_id)?; - } - if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_object_id { - match v { - &ViewGroup_oneof_one_of_sub_group_object_id::sub_group_object_id(ref v) => { - os.write_string(2, v)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewGroup { - ViewGroup::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "group_object_id", - |m: &ViewGroup| { &m.group_object_id }, - |m: &mut ViewGroup| { &mut m.group_object_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "sub_group_object_id", - ViewGroup::has_sub_group_object_id, - ViewGroup::get_sub_group_object_id, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewGroup", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewGroup { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewGroup::new) - } -} - -impl ::protobuf::Clear for ViewGroup { - fn clear(&mut self) { - self.group_object_id.clear(); - self.one_of_sub_group_object_id = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewGroup { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewGroup { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ViewSort { - // message fields - pub object_id: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a ViewSort { - fn default() -> &'a ViewSort { - ::default_instance() - } -} - -impl ViewSort { - pub fn new() -> ViewSort { - ::std::default::Default::default() - } - - // string object_id = 1; - - - pub fn get_object_id(&self) -> &str { - &self.object_id - } - pub fn clear_object_id(&mut self) { - self.object_id.clear(); - } - - // Param is passed by value, moved - pub fn set_object_id(&mut self, v: ::std::string::String) { - self.object_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_object_id(&mut self) -> &mut ::std::string::String { - &mut self.object_id - } - - // Take field - pub fn take_object_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.object_id, ::std::string::String::new()) - } -} - -impl ::protobuf::Message for ViewSort { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.object_id)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.object_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.object_id); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.object_id.is_empty() { - os.write_string(1, &self.object_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ViewSort { - ViewSort::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "object_id", - |m: &ViewSort| { &m.object_id }, - |m: &mut ViewSort| { &mut m.object_id }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "ViewSort", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static ViewSort { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(ViewSort::new) - } -} - -impl ::protobuf::Clear for ViewSort { - fn clear(&mut self) { - self.object_id.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ViewSort { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ViewSort { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct UpdateViewInfoPayload { - // message fields - pub view_id: ::std::string::String, - // message oneof groups - pub one_of_filter: ::std::option::Option, - pub one_of_group: ::std::option::Option, - pub one_of_sort: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a UpdateViewInfoPayload { - fn default() -> &'a UpdateViewInfoPayload { - ::default_instance() - } -} - -#[derive(Clone,PartialEq,Debug)] -pub enum UpdateViewInfoPayload_oneof_one_of_filter { - filter(ViewFilter), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum UpdateViewInfoPayload_oneof_one_of_group { - group(ViewGroup), -} - -#[derive(Clone,PartialEq,Debug)] -pub enum UpdateViewInfoPayload_oneof_one_of_sort { - sort(ViewSort), -} - -impl UpdateViewInfoPayload { - pub fn new() -> UpdateViewInfoPayload { - ::std::default::Default::default() - } - - // string view_id = 1; - - - pub fn get_view_id(&self) -> &str { - &self.view_id - } - pub fn clear_view_id(&mut self) { - self.view_id.clear(); - } - - // Param is passed by value, moved - pub fn set_view_id(&mut self, v: ::std::string::String) { - self.view_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_view_id(&mut self) -> &mut ::std::string::String { - &mut self.view_id - } - - // Take field - pub fn take_view_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.view_id, ::std::string::String::new()) - } - - // .ViewFilter filter = 2; - - - pub fn get_filter(&self) -> &ViewFilter { - match self.one_of_filter { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v)) => v, - _ => ::default_instance(), - } - } - pub fn clear_filter(&mut self) { - self.one_of_filter = ::std::option::Option::None; - } - - pub fn has_filter(&self) -> bool { - match self.one_of_filter { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_filter(&mut self, v: ViewFilter) { - self.one_of_filter = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(v)) - } - - // Mutable pointer to the field. - pub fn mut_filter(&mut self) -> &mut ViewFilter { - if let ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(_)) = self.one_of_filter { - } else { - self.one_of_filter = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ViewFilter::new())); - } - match self.one_of_filter { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_filter(&mut self) -> ViewFilter { - if self.has_filter() { - match self.one_of_filter.take() { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(v)) => v, - _ => panic!(), - } - } else { - ViewFilter::new() - } - } - - // .ViewGroup group = 3; - - - pub fn get_group(&self) -> &ViewGroup { - match self.one_of_group { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(ref v)) => v, - _ => ::default_instance(), - } - } - pub fn clear_group(&mut self) { - self.one_of_group = ::std::option::Option::None; - } - - pub fn has_group(&self) -> bool { - match self.one_of_group { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_group(&mut self, v: ViewGroup) { - self.one_of_group = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(v)) - } - - // Mutable pointer to the field. - pub fn mut_group(&mut self) -> &mut ViewGroup { - if let ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(_)) = self.one_of_group { - } else { - self.one_of_group = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(ViewGroup::new())); - } - match self.one_of_group { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_group(&mut self) -> ViewGroup { - if self.has_group() { - match self.one_of_group.take() { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(v)) => v, - _ => panic!(), - } - } else { - ViewGroup::new() - } - } - - // .ViewSort sort = 4; - - - pub fn get_sort(&self) -> &ViewSort { - match self.one_of_sort { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v)) => v, - _ => ::default_instance(), - } - } - pub fn clear_sort(&mut self) { - self.one_of_sort = ::std::option::Option::None; - } - - pub fn has_sort(&self) -> bool { - match self.one_of_sort { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_sort(&mut self, v: ViewSort) { - self.one_of_sort = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(v)) - } - - // Mutable pointer to the field. - pub fn mut_sort(&mut self) -> &mut ViewSort { - if let ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(_)) = self.one_of_sort { - } else { - self.one_of_sort = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ViewSort::new())); - } - match self.one_of_sort { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_sort(&mut self) -> ViewSort { - if self.has_sort() { - match self.one_of_sort.take() { - ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(v)) => v, - _ => panic!(), - } - } else { - ViewSort::new() - } - } -} - -impl ::protobuf::Message for UpdateViewInfoPayload { - fn is_initialized(&self) -> bool { - if let Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v)) = self.one_of_filter { - if !v.is_initialized() { - return false; - } - } - if let Some(UpdateViewInfoPayload_oneof_one_of_group::group(ref v)) = self.one_of_group { - if !v.is_initialized() { - return false; - } - } - if let Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v)) = self.one_of_sort { - if !v.is_initialized() { - return false; - } - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.view_id)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_filter = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_filter::filter(is.read_message()?)); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_group = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_group::group(is.read_message()?)); - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.one_of_sort = ::std::option::Option::Some(UpdateViewInfoPayload_oneof_one_of_sort::sort(is.read_message()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.view_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.view_id); - } - if let ::std::option::Option::Some(ref v) = self.one_of_filter { - match v { - &UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_group { - match v { - &UpdateViewInfoPayload_oneof_one_of_group::group(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_sort { - match v { - &UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.view_id.is_empty() { - os.write_string(1, &self.view_id)?; - } - if let ::std::option::Option::Some(ref v) = self.one_of_filter { - match v { - &UpdateViewInfoPayload_oneof_one_of_filter::filter(ref v) => { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_group { - match v { - &UpdateViewInfoPayload_oneof_one_of_group::group(ref v) => { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - }; - } - if let ::std::option::Option::Some(ref v) = self.one_of_sort { - match v { - &UpdateViewInfoPayload_oneof_one_of_sort::sort(ref v) => { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> UpdateViewInfoPayload { - UpdateViewInfoPayload::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "view_id", - |m: &UpdateViewInfoPayload| { &m.view_id }, - |m: &mut UpdateViewInfoPayload| { &mut m.view_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewFilter>( - "filter", - UpdateViewInfoPayload::has_filter, - UpdateViewInfoPayload::get_filter, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewGroup>( - "group", - UpdateViewInfoPayload::has_group, - UpdateViewInfoPayload::get_group, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewSort>( - "sort", - UpdateViewInfoPayload::has_sort, - UpdateViewInfoPayload::get_sort, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "UpdateViewInfoPayload", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static UpdateViewInfoPayload { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(UpdateViewInfoPayload::new) - } -} - -impl ::protobuf::Clear for UpdateViewInfoPayload { - fn clear(&mut self) { - self.view_id.clear(); - self.one_of_filter = ::std::option::Option::None; - self.one_of_group = ::std::option::Option::None; - self.one_of_sort = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for UpdateViewInfoPayload { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for UpdateViewInfoPayload { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0fview_info.proto\x1a\nview.proto\"\xe8\x01\n\x08ViewInfo\x12\x0e\n\ + \n\x0fview_info.proto\x1a\nview.proto\"\xda\x01\n\x08ViewInfo\x12\x0e\n\ \x02id\x18\x01\x20\x01(\tR\x02id\x12\x20\n\x0cbelong_to_id\x18\x02\x20\ \x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x03\x20\x01(\tR\x04name\x12\ \x12\n\x04desc\x18\x04\x20\x01(\tR\x04desc\x12*\n\tdata_type\x18\x05\x20\ \x01(\x0e2\r.ViewDataTypeR\x08dataType\x12-\n\nbelongings\x18\x06\x20\ - \x01(\x0b2\r.RepeatedViewR\nbelongings\x12'\n\x08ext_data\x18\x07\x20\ - \x01(\x0b2\x0c.ViewExtDataR\x07extData\"s\n\x0bViewExtData\x12#\n\x06fil\ - ter\x18\x01\x20\x01(\x0b2\x0b.ViewFilterR\x06filter\x12\x20\n\x05group\ - \x18\x02\x20\x01(\x0b2\n.ViewGroupR\x05group\x12\x1d\n\x04sort\x18\x03\ - \x20\x01(\x0b2\t.ViewSortR\x04sort\")\n\nViewFilter\x12\x1b\n\tobject_id\ - \x18\x01\x20\x01(\tR\x08objectId\"\x82\x01\n\tViewGroup\x12&\n\x0fgroup_\ - object_id\x18\x01\x20\x01(\tR\rgroupObjectId\x12/\n\x13sub_group_object_\ - id\x18\x02\x20\x01(\tH\0R\x10subGroupObjectIdB\x1c\n\x1aone_of_sub_group\ - _object_id\"'\n\x08ViewSort\x12\x1b\n\tobject_id\x18\x01\x20\x01(\tR\x08\ - objectId\"\xcc\x01\n\x15UpdateViewInfoPayload\x12\x17\n\x07view_id\x18\ - \x01\x20\x01(\tR\x06viewId\x12%\n\x06filter\x18\x02\x20\x01(\x0b2\x0b.Vi\ - ewFilterH\0R\x06filter\x12\"\n\x05group\x18\x03\x20\x01(\x0b2\n.ViewGrou\ - pH\x01R\x05group\x12\x1f\n\x04sort\x18\x04\x20\x01(\x0b2\t.ViewSortH\x02\ - R\x04sortB\x0f\n\rone_of_filterB\x0e\n\x0cone_of_groupB\r\n\x0bone_of_so\ - rtb\x06proto3\ + \x01(\x0b2\r.RepeatedViewR\nbelongings\x12\x19\n\x08ext_data\x18\x07\x20\ + \x01(\tR\x07extDatab\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto index 29692ba2a9..90d115c3a8 100644 --- a/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto +++ b/shared-lib/flowy-folder-data-model/src/protobuf/proto/view_info.proto @@ -8,26 +8,5 @@ message ViewInfo { string desc = 4; ViewDataType data_type = 5; RepeatedView belongings = 6; - ViewExtData ext_data = 7; -} -message ViewExtData { - ViewFilter filter = 1; - ViewGroup group = 2; - ViewSort sort = 3; -} -message ViewFilter { - string object_id = 1; -} -message ViewGroup { - string group_object_id = 1; - oneof one_of_sub_group_object_id { string sub_group_object_id = 2; }; -} -message ViewSort { - string object_id = 1; -} -message UpdateViewInfoPayload { - string view_id = 1; - oneof one_of_filter { ViewFilter filter = 2; }; - oneof one_of_group { ViewGroup group = 3; }; - oneof one_of_sort { ViewSort sort = 4; }; + string ext_data = 7; } diff --git a/shared-lib/flowy-folder-data-model/src/revision/app.rs b/shared-lib/flowy-folder-data-model/src/revision/app_rev.rs similarity index 100% rename from shared-lib/flowy-folder-data-model/src/revision/app.rs rename to shared-lib/flowy-folder-data-model/src/revision/app_rev.rs diff --git a/shared-lib/flowy-folder-data-model/src/revision/mod.rs b/shared-lib/flowy-folder-data-model/src/revision/mod.rs index d31c9b72e8..6a837ac035 100644 --- a/shared-lib/flowy-folder-data-model/src/revision/mod.rs +++ b/shared-lib/flowy-folder-data-model/src/revision/mod.rs @@ -1,9 +1,9 @@ -mod app; -mod trash; -mod view; -mod workspace; +mod app_rev; +mod trash_rev; +mod view_rev; +mod workspace_rev; -pub use app::*; -pub use trash::*; -pub use view::*; -pub use workspace::*; +pub use app_rev::*; +pub use trash_rev::*; +pub use view_rev::*; +pub use workspace_rev::*; diff --git a/shared-lib/flowy-folder-data-model/src/revision/trash.rs b/shared-lib/flowy-folder-data-model/src/revision/trash_rev.rs similarity index 100% rename from shared-lib/flowy-folder-data-model/src/revision/trash.rs rename to shared-lib/flowy-folder-data-model/src/revision/trash_rev.rs diff --git a/shared-lib/flowy-folder-data-model/src/revision/view.rs b/shared-lib/flowy-folder-data-model/src/revision/view.rs deleted file mode 100644 index 63a87bf82c..0000000000 --- a/shared-lib/flowy-folder-data-model/src/revision/view.rs +++ /dev/null @@ -1,142 +0,0 @@ -use crate::entities::view::{View, ViewDataType}; -use crate::entities::{RepeatedView, TrashType, ViewExtData, ViewFilter, ViewGroup, ViewSort}; -use crate::revision::TrashRevision; -use serde::{Deserialize, Serialize}; - -#[derive(Default, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] -pub struct ViewRevision { - pub id: String, - - pub belong_to_id: String, - - pub name: String, - - pub desc: String, - - #[serde(default)] - pub data_type: ViewDataType, - - pub version: i64, - - pub belongings: Vec, - - pub modified_time: i64, - - pub create_time: i64, - - #[serde(default)] - pub ext_data: String, - - #[serde(default)] - pub thumbnail: String, - - #[serde(default = "default_plugin_type")] - pub plugin_type: i32, -} - -fn default_plugin_type() -> i32 { - 0 -} - -impl std::convert::From for View { - fn from(view_serde: ViewRevision) -> Self { - View { - id: view_serde.id, - belong_to_id: view_serde.belong_to_id, - name: view_serde.name, - data_type: view_serde.data_type, - modified_time: view_serde.modified_time, - create_time: view_serde.create_time, - plugin_type: view_serde.plugin_type, - } - } -} - -impl std::convert::From for TrashRevision { - fn from(view_rev: ViewRevision) -> Self { - TrashRevision { - id: view_rev.id, - name: view_rev.name, - modified_time: view_rev.modified_time, - create_time: view_rev.create_time, - ty: TrashType::TrashView, - } - } -} - -#[derive(Serialize, Deserialize)] -pub struct ViewExtDataRevision { - pub filter: ViewFilterRevision, - pub group: ViewGroupRevision, - pub sort: ViewSortRevision, -} - -#[derive(Serialize, Deserialize)] -pub struct ViewFilterRevision { - pub field_id: String, -} - -#[derive(Serialize, Deserialize)] -pub struct ViewGroupRevision { - pub group_field_id: String, - pub sub_group_field_id: Option, -} - -#[derive(Serialize, Deserialize)] -pub struct ViewSortRevision { - field_id: String, -} - -impl std::convert::From for ViewExtData { - fn from(s: String) -> Self { - match serde_json::from_str::(&s) { - Ok(data) => data.into(), - Err(err) => { - log::error!("{:?}", err); - ViewExtData::default() - } - } - } -} - -impl std::convert::From for ViewExtData { - fn from(rev: ViewExtDataRevision) -> Self { - ViewExtData { - filter: rev.filter.into(), - group: rev.group.into(), - sort: rev.sort.into(), - } - } -} - -impl std::convert::From for ViewFilter { - fn from(rev: ViewFilterRevision) -> Self { - ViewFilter { - object_id: rev.field_id, - } - } -} - -impl std::convert::From for ViewGroup { - fn from(rev: ViewGroupRevision) -> Self { - ViewGroup { - group_object_id: rev.group_field_id, - sub_group_object_id: rev.sub_group_field_id, - } - } -} - -impl std::convert::From for ViewSort { - fn from(rev: ViewSortRevision) -> Self { - ViewSort { - object_id: rev.field_id, - } - } -} - -impl std::convert::From> for RepeatedView { - fn from(values: Vec) -> Self { - let items = values.into_iter().map(|value| value.into()).collect::>(); - RepeatedView { items } - } -} diff --git a/shared-lib/flowy-folder-data-model/src/revision/view_rev.rs b/shared-lib/flowy-folder-data-model/src/revision/view_rev.rs new file mode 100644 index 0000000000..7d78e555f6 --- /dev/null +++ b/shared-lib/flowy-folder-data-model/src/revision/view_rev.rs @@ -0,0 +1,71 @@ +use crate::entities::view::{View, ViewDataType}; +use crate::entities::{RepeatedView, TrashType}; +use crate::revision::TrashRevision; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct ViewRevision { + pub id: String, + + pub belong_to_id: String, + + pub name: String, + + pub desc: String, + + #[serde(default)] + pub data_type: ViewDataType, + + pub version: i64, + + pub belongings: Vec, + + pub modified_time: i64, + + pub create_time: i64, + + #[serde(default)] + pub ext_data: String, + + #[serde(default)] + pub thumbnail: String, + + #[serde(default = "default_plugin_type")] + pub plugin_type: i32, +} + +fn default_plugin_type() -> i32 { + 0 +} + +impl std::convert::From for View { + fn from(view_serde: ViewRevision) -> Self { + View { + id: view_serde.id, + belong_to_id: view_serde.belong_to_id, + name: view_serde.name, + data_type: view_serde.data_type, + modified_time: view_serde.modified_time, + create_time: view_serde.create_time, + plugin_type: view_serde.plugin_type, + } + } +} + +impl std::convert::From for TrashRevision { + fn from(view_rev: ViewRevision) -> Self { + TrashRevision { + id: view_rev.id, + name: view_rev.name, + modified_time: view_rev.modified_time, + create_time: view_rev.create_time, + ty: TrashType::TrashView, + } + } +} +impl std::convert::From> for RepeatedView { + fn from(values: Vec) -> Self { + let items = values.into_iter().map(|value| value.into()).collect::>(); + RepeatedView { items } + } +} diff --git a/shared-lib/flowy-folder-data-model/src/revision/workspace.rs b/shared-lib/flowy-folder-data-model/src/revision/workspace_rev.rs similarity index 100% rename from shared-lib/flowy-folder-data-model/src/revision/workspace.rs rename to shared-lib/flowy-folder-data-model/src/revision/workspace_rev.rs diff --git a/shared-lib/flowy-grid-data-model/src/entities/field.rs b/shared-lib/flowy-grid-data-model/src/entities/field.rs index d0428212bb..cb886fcb61 100644 --- a/shared-lib/flowy-grid-data-model/src/entities/field.rs +++ b/shared-lib/flowy-grid-data-model/src/entities/field.rs @@ -1,10 +1,8 @@ use crate::parser::NotEmptyStr; -use crate::revision::{CellRevision, FieldRevision, RowMetaChangeset, RowRevision}; +use crate::revision::FieldRevision; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use flowy_error_code::ErrorCode; - use serde_repr::*; - use strum_macros::{Display, EnumCount as EnumCountMacro, EnumIter, EnumString}; #[derive(Debug, Clone, Default, ProtoBuf)] diff --git a/shared-lib/flowy-grid-data-model/src/entities/grid.rs b/shared-lib/flowy-grid-data-model/src/entities/grid.rs index 870652b7da..dd5cf40e3b 100644 --- a/shared-lib/flowy-grid-data-model/src/entities/grid.rs +++ b/shared-lib/flowy-grid-data-model/src/entities/grid.rs @@ -1,6 +1,6 @@ use crate::entities::FieldOrder; use crate::parser::NotEmptyStr; -use crate::revision::{CellRevision, FieldRevision, RowMetaChangeset, RowRevision}; +use crate::revision::RowRevision; use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use flowy_error_code::ErrorCode; diff --git a/shared-lib/flowy-grid-data-model/src/entities/grid_info.rs b/shared-lib/flowy-grid-data-model/src/entities/grid_info.rs new file mode 100644 index 0000000000..5c532bfeb2 --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/entities/grid_info.rs @@ -0,0 +1,91 @@ +use crate::parser::{NotEmptyStr, ViewFilterParser, ViewGroupParser, ViewSortParser}; +use flowy_derive::ProtoBuf; +use flowy_error_code::ErrorCode; +use std::convert::TryInto; + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewExtData { + #[pb(index = 1)] + pub filter: ViewFilter, + + #[pb(index = 2)] + pub group: ViewGroup, + + #[pb(index = 3)] + pub sort: ViewSort, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewFilter { + #[pb(index = 1, one_of)] + pub field_id: Option, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewGroup { + #[pb(index = 1, one_of)] + pub group_field_id: Option, + + #[pb(index = 2, one_of)] + pub sub_group_field_id: Option, +} + +#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)] +pub struct ViewSort { + #[pb(index = 1, one_of)] + pub field_id: Option, +} + +#[derive(Default, ProtoBuf)] +pub struct GridInfoChangesetPayload { + #[pb(index = 1)] + pub grid_id: String, + + #[pb(index = 2, one_of)] + pub filter: Option, + + #[pb(index = 3, one_of)] + pub group: Option, + + #[pb(index = 4, one_of)] + pub sort: Option, +} + +pub struct GridInfoChangesetParams { + pub view_id: String, + pub filter: Option, + pub group: Option, + pub sort: Option, +} + +impl TryInto for GridInfoChangesetPayload { + type Error = ErrorCode; + + fn try_into(self) -> Result { + let view_id = NotEmptyStr::parse(self.grid_id) + .map_err(|_| ErrorCode::FieldIdIsEmpty)? + .0; + + let filter = match self.filter { + None => None, + Some(filter) => Some(ViewFilterParser::parse(filter)?), + }; + + let group = match self.group { + None => None, + Some(group) => Some(ViewGroupParser::parse(group)?), + }; + + let sort = match self.sort { + None => None, + Some(sort) => Some(ViewSortParser::parse(sort)?), + }; + + Ok(GridInfoChangesetParams { + view_id, + filter, + group, + sort, + }) + } +} diff --git a/shared-lib/flowy-grid-data-model/src/entities/mod.rs b/shared-lib/flowy-grid-data-model/src/entities/mod.rs index 7e595e4f75..6021d90167 100644 --- a/shared-lib/flowy-grid-data-model/src/entities/mod.rs +++ b/shared-lib/flowy-grid-data-model/src/entities/mod.rs @@ -1,5 +1,7 @@ mod field; mod grid; +mod grid_info; pub use field::*; pub use grid::*; +pub use grid_info::*; diff --git a/shared-lib/flowy-grid-data-model/src/parser/grid_info_parser.rs b/shared-lib/flowy-grid-data-model/src/parser/grid_info_parser.rs new file mode 100644 index 0000000000..799cfe520c --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/parser/grid_info_parser.rs @@ -0,0 +1,58 @@ +use crate::entities::{ViewFilter, ViewGroup, ViewSort}; +use crate::parser::NotEmptyStr; +use flowy_error_code::ErrorCode; + +pub struct ViewFilterParser(pub ViewFilter); + +impl ViewFilterParser { + pub fn parse(value: ViewFilter) -> Result { + let field_id = match value.field_id { + None => None, + Some(field_id) => Some(NotEmptyStr::parse(field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?.0), + }; + + Ok(ViewFilter { field_id }) + } +} + +pub struct ViewGroupParser(pub ViewGroup); + +impl ViewGroupParser { + pub fn parse(value: ViewGroup) -> Result { + let group_field_id = match value.group_field_id { + None => None, + Some(group_field_id) => Some( + NotEmptyStr::parse(group_field_id) + .map_err(|_| ErrorCode::FieldIdIsEmpty)? + .0, + ), + }; + + let sub_group_field_id = match value.sub_group_field_id { + None => None, + Some(sub_group_field_id) => Some( + NotEmptyStr::parse(sub_group_field_id) + .map_err(|_| ErrorCode::FieldIdIsEmpty)? + .0, + ), + }; + + Ok(ViewGroup { + group_field_id, + sub_group_field_id, + }) + } +} + +pub struct ViewSortParser(pub ViewSort); + +impl ViewSortParser { + pub fn parse(value: ViewSort) -> Result { + let field_id = match value.field_id { + None => None, + Some(field_id) => Some(NotEmptyStr::parse(field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?.0), + }; + + Ok(ViewSort { field_id }) + } +} diff --git a/shared-lib/flowy-grid-data-model/src/parser/mod.rs b/shared-lib/flowy-grid-data-model/src/parser/mod.rs index 3c43c76f39..270d4ca043 100644 --- a/shared-lib/flowy-grid-data-model/src/parser/mod.rs +++ b/shared-lib/flowy-grid-data-model/src/parser/mod.rs @@ -1,3 +1,5 @@ +mod grid_info_parser; mod str_parser; +pub use grid_info_parser::*; pub use str_parser::*; diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/model/grid_info.rs b/shared-lib/flowy-grid-data-model/src/protobuf/model/grid_info.rs new file mode 100644 index 0000000000..61fd1de2bd --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/protobuf/model/grid_info.rs @@ -0,0 +1,1444 @@ +// This file is generated by rust-protobuf 2.25.2. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `grid_info.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2; + +#[derive(PartialEq,Clone,Default)] +pub struct ViewExtData { + // message fields + pub filter: ::protobuf::SingularPtrField, + pub group: ::protobuf::SingularPtrField, + pub sort: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewExtData { + fn default() -> &'a ViewExtData { + ::default_instance() + } +} + +impl ViewExtData { + pub fn new() -> ViewExtData { + ::std::default::Default::default() + } + + // .ViewFilter filter = 1; + + + pub fn get_filter(&self) -> &ViewFilter { + self.filter.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_filter(&mut self) { + self.filter.clear(); + } + + pub fn has_filter(&self) -> bool { + self.filter.is_some() + } + + // Param is passed by value, moved + pub fn set_filter(&mut self, v: ViewFilter) { + self.filter = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_filter(&mut self) -> &mut ViewFilter { + if self.filter.is_none() { + self.filter.set_default(); + } + self.filter.as_mut().unwrap() + } + + // Take field + pub fn take_filter(&mut self) -> ViewFilter { + self.filter.take().unwrap_or_else(|| ViewFilter::new()) + } + + // .ViewGroup group = 2; + + + pub fn get_group(&self) -> &ViewGroup { + self.group.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_group(&mut self) { + self.group.clear(); + } + + pub fn has_group(&self) -> bool { + self.group.is_some() + } + + // Param is passed by value, moved + pub fn set_group(&mut self, v: ViewGroup) { + self.group = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_group(&mut self) -> &mut ViewGroup { + if self.group.is_none() { + self.group.set_default(); + } + self.group.as_mut().unwrap() + } + + // Take field + pub fn take_group(&mut self) -> ViewGroup { + self.group.take().unwrap_or_else(|| ViewGroup::new()) + } + + // .ViewSort sort = 3; + + + pub fn get_sort(&self) -> &ViewSort { + self.sort.as_ref().unwrap_or_else(|| ::default_instance()) + } + pub fn clear_sort(&mut self) { + self.sort.clear(); + } + + pub fn has_sort(&self) -> bool { + self.sort.is_some() + } + + // Param is passed by value, moved + pub fn set_sort(&mut self, v: ViewSort) { + self.sort = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sort(&mut self) -> &mut ViewSort { + if self.sort.is_none() { + self.sort.set_default(); + } + self.sort.as_mut().unwrap() + } + + // Take field + pub fn take_sort(&mut self) -> ViewSort { + self.sort.take().unwrap_or_else(|| ViewSort::new()) + } +} + +impl ::protobuf::Message for ViewExtData { + fn is_initialized(&self) -> bool { + for v in &self.filter { + if !v.is_initialized() { + return false; + } + }; + for v in &self.group { + if !v.is_initialized() { + return false; + } + }; + for v in &self.sort { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.filter)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.group)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.sort)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.filter.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.group.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.sort.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.filter.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.group.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.sort.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewExtData { + ViewExtData::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "filter", + |m: &ViewExtData| { &m.filter }, + |m: &mut ViewExtData| { &mut m.filter }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "group", + |m: &ViewExtData| { &m.group }, + |m: &mut ViewExtData| { &mut m.group }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "sort", + |m: &ViewExtData| { &m.sort }, + |m: &mut ViewExtData| { &mut m.sort }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewExtData", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewExtData { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewExtData::new) + } +} + +impl ::protobuf::Clear for ViewExtData { + fn clear(&mut self) { + self.filter.clear(); + self.group.clear(); + self.sort.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewExtData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewExtData { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewFilter { + // message oneof groups + pub one_of_field_id: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewFilter { + fn default() -> &'a ViewFilter { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum ViewFilter_oneof_one_of_field_id { + field_id(::std::string::String), +} + +impl ViewFilter { + pub fn new() -> ViewFilter { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + match self.one_of_field_id { + ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_field_id(&mut self) { + self.one_of_field_id = ::std::option::Option::None; + } + + pub fn has_field_id(&self) -> bool { + match self.one_of_field_id { + ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.one_of_field_id = ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(_)) = self.one_of_field_id { + } else { + self.one_of_field_id = ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(::std::string::String::new())); + } + match self.one_of_field_id { + ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + if self.has_field_id() { + match self.one_of_field_id.take() { + ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } +} + +impl ::protobuf::Message for ViewFilter { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_field_id = ::std::option::Option::Some(ViewFilter_oneof_one_of_field_id::field_id(is.read_string()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.one_of_field_id { + match v { + &ViewFilter_oneof_one_of_field_id::field_id(ref v) => { + my_size += ::protobuf::rt::string_size(1, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let ::std::option::Option::Some(ref v) = self.one_of_field_id { + match v { + &ViewFilter_oneof_one_of_field_id::field_id(ref v) => { + os.write_string(1, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewFilter { + ViewFilter::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "field_id", + ViewFilter::has_field_id, + ViewFilter::get_field_id, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewFilter", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewFilter { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewFilter::new) + } +} + +impl ::protobuf::Clear for ViewFilter { + fn clear(&mut self) { + self.one_of_field_id = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewFilter { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewFilter { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewGroup { + // message oneof groups + pub one_of_group_field_id: ::std::option::Option, + pub one_of_sub_group_field_id: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewGroup { + fn default() -> &'a ViewGroup { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum ViewGroup_oneof_one_of_group_field_id { + group_field_id(::std::string::String), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum ViewGroup_oneof_one_of_sub_group_field_id { + sub_group_field_id(::std::string::String), +} + +impl ViewGroup { + pub fn new() -> ViewGroup { + ::std::default::Default::default() + } + + // string group_field_id = 1; + + + pub fn get_group_field_id(&self) -> &str { + match self.one_of_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_group_field_id(&mut self) { + self.one_of_group_field_id = ::std::option::Option::None; + } + + pub fn has_group_field_id(&self) -> bool { + match self.one_of_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_group_field_id(&mut self, v: ::std::string::String) { + self.one_of_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_group_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(_)) = self.one_of_group_field_id { + } else { + self.one_of_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(::std::string::String::new())); + } + match self.one_of_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_group_field_id(&mut self) -> ::std::string::String { + if self.has_group_field_id() { + match self.one_of_group_field_id.take() { + ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } + + // string sub_group_field_id = 2; + + + pub fn get_sub_group_field_id(&self) -> &str { + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_sub_group_field_id(&mut self) { + self.one_of_sub_group_field_id = ::std::option::Option::None; + } + + pub fn has_sub_group_field_id(&self) -> bool { + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_sub_group_field_id(&mut self, v: ::std::string::String) { + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_sub_group_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(_)) = self.one_of_sub_group_field_id { + } else { + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(::std::string::String::new())); + } + match self.one_of_sub_group_field_id { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_sub_group_field_id(&mut self) -> ::std::string::String { + if self.has_sub_group_field_id() { + match self.one_of_sub_group_field_id.take() { + ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } +} + +impl ::protobuf::Message for ViewGroup { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_group_field_id::group_field_id(is.read_string()?)); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_sub_group_field_id = ::std::option::Option::Some(ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(is.read_string()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.one_of_group_field_id { + match v { + &ViewGroup_oneof_one_of_group_field_id::group_field_id(ref v) => { + my_size += ::protobuf::rt::string_size(1, &v); + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + match v { + &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + my_size += ::protobuf::rt::string_size(2, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let ::std::option::Option::Some(ref v) = self.one_of_group_field_id { + match v { + &ViewGroup_oneof_one_of_group_field_id::group_field_id(ref v) => { + os.write_string(1, v)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sub_group_field_id { + match v { + &ViewGroup_oneof_one_of_sub_group_field_id::sub_group_field_id(ref v) => { + os.write_string(2, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewGroup { + ViewGroup::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "group_field_id", + ViewGroup::has_group_field_id, + ViewGroup::get_group_field_id, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "sub_group_field_id", + ViewGroup::has_sub_group_field_id, + ViewGroup::get_sub_group_field_id, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewGroup", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewGroup { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewGroup::new) + } +} + +impl ::protobuf::Clear for ViewGroup { + fn clear(&mut self) { + self.one_of_group_field_id = ::std::option::Option::None; + self.one_of_sub_group_field_id = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewGroup { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewGroup { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ViewSort { + // message oneof groups + pub one_of_field_id: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ViewSort { + fn default() -> &'a ViewSort { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum ViewSort_oneof_one_of_field_id { + field_id(::std::string::String), +} + +impl ViewSort { + pub fn new() -> ViewSort { + ::std::default::Default::default() + } + + // string field_id = 1; + + + pub fn get_field_id(&self) -> &str { + match self.one_of_field_id { + ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(ref v)) => v, + _ => "", + } + } + pub fn clear_field_id(&mut self) { + self.one_of_field_id = ::std::option::Option::None; + } + + pub fn has_field_id(&self) -> bool { + match self.one_of_field_id { + ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_field_id(&mut self, v: ::std::string::String) { + self.one_of_field_id = ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(v)) + } + + // Mutable pointer to the field. + pub fn mut_field_id(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(_)) = self.one_of_field_id { + } else { + self.one_of_field_id = ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(::std::string::String::new())); + } + match self.one_of_field_id { + ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_field_id(&mut self) -> ::std::string::String { + if self.has_field_id() { + match self.one_of_field_id.take() { + ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } +} + +impl ::protobuf::Message for ViewSort { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_field_id = ::std::option::Option::Some(ViewSort_oneof_one_of_field_id::field_id(is.read_string()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.one_of_field_id { + match v { + &ViewSort_oneof_one_of_field_id::field_id(ref v) => { + my_size += ::protobuf::rt::string_size(1, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let ::std::option::Option::Some(ref v) = self.one_of_field_id { + match v { + &ViewSort_oneof_one_of_field_id::field_id(ref v) => { + os.write_string(1, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ViewSort { + ViewSort::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "field_id", + ViewSort::has_field_id, + ViewSort::get_field_id, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "ViewSort", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static ViewSort { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(ViewSort::new) + } +} + +impl ::protobuf::Clear for ViewSort { + fn clear(&mut self) { + self.one_of_field_id = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ViewSort { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ViewSort { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GridInfoChangesetPayload { + // message fields + pub grid_id: ::std::string::String, + // message oneof groups + pub one_of_filter: ::std::option::Option, + pub one_of_group: ::std::option::Option, + pub one_of_sort: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a GridInfoChangesetPayload { + fn default() -> &'a GridInfoChangesetPayload { + ::default_instance() + } +} + +#[derive(Clone,PartialEq,Debug)] +pub enum GridInfoChangesetPayload_oneof_one_of_filter { + filter(ViewFilter), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum GridInfoChangesetPayload_oneof_one_of_group { + group(ViewGroup), +} + +#[derive(Clone,PartialEq,Debug)] +pub enum GridInfoChangesetPayload_oneof_one_of_sort { + sort(ViewSort), +} + +impl GridInfoChangesetPayload { + pub fn new() -> GridInfoChangesetPayload { + ::std::default::Default::default() + } + + // string grid_id = 1; + + + pub fn get_grid_id(&self) -> &str { + &self.grid_id + } + pub fn clear_grid_id(&mut self) { + self.grid_id.clear(); + } + + // Param is passed by value, moved + pub fn set_grid_id(&mut self, v: ::std::string::String) { + self.grid_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grid_id(&mut self) -> &mut ::std::string::String { + &mut self.grid_id + } + + // Take field + pub fn take_grid_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grid_id, ::std::string::String::new()) + } + + // .ViewFilter filter = 2; + + + pub fn get_filter(&self) -> &ViewFilter { + match self.one_of_filter { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(ref v)) => v, + _ => ::default_instance(), + } + } + pub fn clear_filter(&mut self) { + self.one_of_filter = ::std::option::Option::None; + } + + pub fn has_filter(&self) -> bool { + match self.one_of_filter { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_filter(&mut self, v: ViewFilter) { + self.one_of_filter = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(v)) + } + + // Mutable pointer to the field. + pub fn mut_filter(&mut self) -> &mut ViewFilter { + if let ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(_)) = self.one_of_filter { + } else { + self.one_of_filter = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(ViewFilter::new())); + } + match self.one_of_filter { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_filter(&mut self) -> ViewFilter { + if self.has_filter() { + match self.one_of_filter.take() { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(v)) => v, + _ => panic!(), + } + } else { + ViewFilter::new() + } + } + + // .ViewGroup group = 3; + + + pub fn get_group(&self) -> &ViewGroup { + match self.one_of_group { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(ref v)) => v, + _ => ::default_instance(), + } + } + pub fn clear_group(&mut self) { + self.one_of_group = ::std::option::Option::None; + } + + pub fn has_group(&self) -> bool { + match self.one_of_group { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_group(&mut self, v: ViewGroup) { + self.one_of_group = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(v)) + } + + // Mutable pointer to the field. + pub fn mut_group(&mut self) -> &mut ViewGroup { + if let ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(_)) = self.one_of_group { + } else { + self.one_of_group = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(ViewGroup::new())); + } + match self.one_of_group { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_group(&mut self) -> ViewGroup { + if self.has_group() { + match self.one_of_group.take() { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(v)) => v, + _ => panic!(), + } + } else { + ViewGroup::new() + } + } + + // .ViewSort sort = 4; + + + pub fn get_sort(&self) -> &ViewSort { + match self.one_of_sort { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(ref v)) => v, + _ => ::default_instance(), + } + } + pub fn clear_sort(&mut self) { + self.one_of_sort = ::std::option::Option::None; + } + + pub fn has_sort(&self) -> bool { + match self.one_of_sort { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_sort(&mut self, v: ViewSort) { + self.one_of_sort = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(v)) + } + + // Mutable pointer to the field. + pub fn mut_sort(&mut self) -> &mut ViewSort { + if let ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(_)) = self.one_of_sort { + } else { + self.one_of_sort = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(ViewSort::new())); + } + match self.one_of_sort { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_sort(&mut self) -> ViewSort { + if self.has_sort() { + match self.one_of_sort.take() { + ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(v)) => v, + _ => panic!(), + } + } else { + ViewSort::new() + } + } +} + +impl ::protobuf::Message for GridInfoChangesetPayload { + fn is_initialized(&self) -> bool { + if let Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(ref v)) = self.one_of_filter { + if !v.is_initialized() { + return false; + } + } + if let Some(GridInfoChangesetPayload_oneof_one_of_group::group(ref v)) = self.one_of_group { + if !v.is_initialized() { + return false; + } + } + if let Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(ref v)) = self.one_of_sort { + if !v.is_initialized() { + return false; + } + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_filter = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_filter::filter(is.read_message()?)); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_group = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_group::group(is.read_message()?)); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.one_of_sort = ::std::option::Option::Some(GridInfoChangesetPayload_oneof_one_of_sort::sort(is.read_message()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grid_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grid_id); + } + if let ::std::option::Option::Some(ref v) = self.one_of_filter { + match v { + &GridInfoChangesetPayload_oneof_one_of_filter::filter(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_group { + match v { + &GridInfoChangesetPayload_oneof_one_of_group::group(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sort { + match v { + &GridInfoChangesetPayload_oneof_one_of_sort::sort(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.grid_id.is_empty() { + os.write_string(1, &self.grid_id)?; + } + if let ::std::option::Option::Some(ref v) = self.one_of_filter { + match v { + &GridInfoChangesetPayload_oneof_one_of_filter::filter(ref v) => { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_group { + match v { + &GridInfoChangesetPayload_oneof_one_of_group::group(ref v) => { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + }; + } + if let ::std::option::Option::Some(ref v) = self.one_of_sort { + match v { + &GridInfoChangesetPayload_oneof_one_of_sort::sort(ref v) => { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> GridInfoChangesetPayload { + GridInfoChangesetPayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grid_id", + |m: &GridInfoChangesetPayload| { &m.grid_id }, + |m: &mut GridInfoChangesetPayload| { &mut m.grid_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewFilter>( + "filter", + GridInfoChangesetPayload::has_filter, + GridInfoChangesetPayload::get_filter, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewGroup>( + "group", + GridInfoChangesetPayload::has_group, + GridInfoChangesetPayload::get_group, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ViewSort>( + "sort", + GridInfoChangesetPayload::has_sort, + GridInfoChangesetPayload::get_sort, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "GridInfoChangesetPayload", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static GridInfoChangesetPayload { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(GridInfoChangesetPayload::new) + } +} + +impl ::protobuf::Clear for GridInfoChangesetPayload { + fn clear(&mut self) { + self.grid_id.clear(); + self.one_of_filter = ::std::option::Option::None; + self.one_of_group = ::std::option::Option::None; + self.one_of_sort = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GridInfoChangesetPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GridInfoChangesetPayload { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0fgrid_info.proto\"s\n\x0bViewExtData\x12#\n\x06filter\x18\x01\x20\ + \x01(\x0b2\x0b.ViewFilterR\x06filter\x12\x20\n\x05group\x18\x02\x20\x01(\ + \x0b2\n.ViewGroupR\x05group\x12\x1d\n\x04sort\x18\x03\x20\x01(\x0b2\t.Vi\ + ewSortR\x04sort\"<\n\nViewFilter\x12\x1b\n\x08field_id\x18\x01\x20\x01(\ + \tH\0R\x07fieldIdB\x11\n\x0fone_of_field_id\"\x98\x01\n\tViewGroup\x12&\ + \n\x0egroup_field_id\x18\x01\x20\x01(\tH\0R\x0cgroupFieldId\x12-\n\x12su\ + b_group_field_id\x18\x02\x20\x01(\tH\x01R\x0fsubGroupFieldIdB\x17\n\x15o\ + ne_of_group_field_idB\x1b\n\x19one_of_sub_group_field_id\":\n\x08ViewSor\ + t\x12\x1b\n\x08field_id\x18\x01\x20\x01(\tH\0R\x07fieldIdB\x11\n\x0fone_\ + of_field_id\"\xcf\x01\n\x18GridInfoChangesetPayload\x12\x17\n\x07grid_id\ + \x18\x01\x20\x01(\tR\x06gridId\x12%\n\x06filter\x18\x02\x20\x01(\x0b2\ + \x0b.ViewFilterH\0R\x06filter\x12\"\n\x05group\x18\x03\x20\x01(\x0b2\n.V\ + iewGroupH\x01R\x05group\x12\x1f\n\x04sort\x18\x04\x20\x01(\x0b2\t.ViewSo\ + rtH\x02R\x04sortB\x0f\n\rone_of_filterB\x0e\n\x0cone_of_groupB\r\n\x0bon\ + e_of_sortb\x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs b/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs index d066a6e3d8..7f51b05b38 100644 --- a/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs +++ b/shared-lib/flowy-grid-data-model/src/protobuf/model/mod.rs @@ -4,5 +4,8 @@ mod grid; pub use grid::*; +mod grid_info; +pub use grid_info::*; + mod field; pub use field::*; diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid_info.proto b/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid_info.proto new file mode 100644 index 0000000000..53a3a7345b --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid_info.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +message ViewExtData { + ViewFilter filter = 1; + ViewGroup group = 2; + ViewSort sort = 3; +} +message ViewFilter { + oneof one_of_field_id { string field_id = 1; }; +} +message ViewGroup { + oneof one_of_group_field_id { string group_field_id = 1; }; + oneof one_of_sub_group_field_id { string sub_group_field_id = 2; }; +} +message ViewSort { + oneof one_of_field_id { string field_id = 1; }; +} +message GridInfoChangesetPayload { + string grid_id = 1; + oneof one_of_filter { ViewFilter filter = 2; }; + oneof one_of_group { ViewGroup group = 3; }; + oneof one_of_sort { ViewSort sort = 4; }; +} diff --git a/shared-lib/flowy-grid-data-model/src/revision/grid_info_rev.rs b/shared-lib/flowy-grid-data-model/src/revision/grid_info_rev.rs new file mode 100644 index 0000000000..bea1272e36 --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/revision/grid_info_rev.rs @@ -0,0 +1,66 @@ +use crate::entities::{ViewFilter, ViewGroup, ViewSort}; +use serde::{Deserialize, Serialize}; +use serde_repr::*; + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +pub struct GridInfoRevision { + pub filter: GridFilterRevision, + pub group: GridGroupRevision, + pub sort: GridSortRevision, + pub layout: GridLayoutRevision, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +pub struct GridLayoutRevision { + pub ty: GridLayoutType, +} + +#[derive(Debug, Clone, Serialize_repr, Deserialize_repr)] +#[repr(u8)] +pub enum GridLayoutType { + Table = 0, + Board = 1, +} + +impl std::default::Default for GridLayoutType { + fn default() -> Self { + GridLayoutType::Table + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +pub struct GridFilterRevision { + pub field_id: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +pub struct GridGroupRevision { + pub group_field_id: Option, + pub sub_group_field_id: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +pub struct GridSortRevision { + field_id: Option, +} + +impl std::convert::From for ViewFilter { + fn from(rev: GridFilterRevision) -> Self { + ViewFilter { field_id: rev.field_id } + } +} + +impl std::convert::From for ViewGroup { + fn from(rev: GridGroupRevision) -> Self { + ViewGroup { + group_field_id: rev.group_field_id, + sub_group_field_id: rev.sub_group_field_id, + } + } +} + +impl std::convert::From for ViewSort { + fn from(rev: GridSortRevision) -> Self { + ViewSort { field_id: rev.field_id } + } +} diff --git a/shared-lib/flowy-grid-data-model/src/revision/grid_rev.rs b/shared-lib/flowy-grid-data-model/src/revision/grid_rev.rs new file mode 100644 index 0000000000..641cd3d6e0 --- /dev/null +++ b/shared-lib/flowy-grid-data-model/src/revision/grid_rev.rs @@ -0,0 +1,310 @@ +use crate::entities::{CellChangeset, Field, FieldOrder, FieldType, RowOrder}; +use crate::revision::GridInfoRevision; +use bytes::Bytes; +use indexmap::IndexMap; +use nanoid::nanoid; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::sync::Arc; + +pub const DEFAULT_ROW_HEIGHT: i32 = 42; + +pub fn gen_grid_id() -> String { + // nanoid calculator https://zelark.github.io/nano-id-cc/ + nanoid!(10) +} + +pub fn gen_block_id() -> String { + nanoid!(10) +} + +pub fn gen_row_id() -> String { + nanoid!(6) +} + +pub fn gen_field_id() -> String { + nanoid!(6) +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct GridRevision { + pub grid_id: String, + pub fields: Vec, + pub blocks: Vec, + + #[serde(default, skip)] + pub info: GridInfoRevision, +} + +impl GridRevision { + pub fn new(grid_id: &str) -> Self { + Self { + grid_id: grid_id.to_owned(), + fields: vec![], + blocks: vec![], + info: GridInfoRevision::default(), + } + } +} + +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub struct GridBlockRevision { + pub block_id: String, + pub start_row_index: i32, + pub row_count: i32, +} + +impl GridBlockRevision { + pub fn len(&self) -> i32 { + self.row_count + } + + pub fn is_empty(&self) -> bool { + self.row_count == 0 + } +} + +impl GridBlockRevision { + pub fn new() -> Self { + GridBlockRevision { + block_id: gen_block_id(), + ..Default::default() + } + } +} + +pub struct GridBlockRevisionChangeset { + pub block_id: String, + pub start_row_index: Option, + pub row_count: Option, +} + +impl GridBlockRevisionChangeset { + pub fn from_row_count(block_id: &str, row_count: i32) -> Self { + Self { + block_id: block_id.to_string(), + start_row_index: None, + row_count: Some(row_count), + } + } +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct GridBlockRevisionData { + pub block_id: String, + pub rows: Vec, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq)] +pub struct FieldRevision { + pub id: String, + + pub name: String, + + pub desc: String, + + pub field_type: FieldType, + + pub frozen: bool, + + pub visibility: bool, + + pub width: i32, + + /// type_options contains key/value pairs + /// key: id of the FieldType + /// value: type option data that can be parsed into specified TypeOptionStruct. + /// For example, CheckboxTypeOption, MultiSelectTypeOption etc. + #[serde(with = "indexmap::serde_seq")] + pub type_options: IndexMap, + + #[serde(default = "default_is_primary")] + pub is_primary: bool, +} + +fn default_is_primary() -> bool { + false +} + +impl FieldRevision { + pub fn new(name: &str, desc: &str, field_type: FieldType, is_primary: bool) -> Self { + let width = field_type.default_cell_width(); + Self { + id: gen_field_id(), + name: name.to_string(), + desc: desc.to_string(), + field_type, + frozen: false, + visibility: true, + width, + type_options: Default::default(), + is_primary, + } + } + + pub fn insert_type_option_entry(&mut self, entry: &T) + where + T: TypeOptionDataEntry + ?Sized, + { + self.type_options.insert(entry.field_type().type_id(), entry.json_str()); + } + + pub fn get_type_option_entry(&self, field_type: &FieldType) -> Option { + self.type_options + .get(&field_type.type_id()) + .map(|s| T::from_json_str(s)) + } + + pub fn insert_type_option_str(&mut self, field_type: &FieldType, json_str: String) { + self.type_options.insert(field_type.type_id(), json_str); + } + + pub fn get_type_option_str(&self, field_type: &FieldType) -> Option { + self.type_options.get(&field_type.type_id()).map(|s| s.to_owned()) + } +} + +impl std::convert::From for Field { + fn from(field_rev: FieldRevision) -> Self { + Self { + id: field_rev.id, + name: field_rev.name, + desc: field_rev.desc, + field_type: field_rev.field_type, + frozen: field_rev.frozen, + visibility: field_rev.visibility, + width: field_rev.width, + is_primary: field_rev.is_primary, + } + } +} + +impl std::convert::From<&FieldRevision> for FieldOrder { + fn from(field_rev: &FieldRevision) -> Self { + Self { + field_id: field_rev.id.clone(), + } + } +} + +pub trait TypeOptionDataEntry { + fn field_type(&self) -> FieldType; + fn json_str(&self) -> String; + fn protobuf_bytes(&self) -> Bytes; +} + +pub trait TypeOptionDataDeserializer { + fn from_json_str(s: &str) -> Self; + fn from_protobuf_bytes(bytes: Bytes) -> Self; +} + +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub struct RowRevision { + pub id: String, + pub block_id: String, + /// cells contains key/value pairs. + /// key: field id, + /// value: CellMeta + #[serde(with = "indexmap::serde_seq")] + pub cells: IndexMap, + pub height: i32, + pub visibility: bool, +} + +impl RowRevision { + pub fn new(block_id: &str) -> Self { + Self { + id: gen_row_id(), + block_id: block_id.to_owned(), + cells: Default::default(), + height: DEFAULT_ROW_HEIGHT, + visibility: true, + } + } +} + +impl std::convert::From<&RowRevision> for RowOrder { + fn from(row: &RowRevision) -> Self { + Self { + row_id: row.id.clone(), + block_id: row.block_id.clone(), + height: row.height, + } + } +} + +impl std::convert::From<&Arc> for RowOrder { + fn from(row: &Arc) -> Self { + Self { + row_id: row.id.clone(), + block_id: row.block_id.clone(), + height: row.height, + } + } +} + +#[derive(Debug, Clone, Default)] +pub struct RowMetaChangeset { + pub row_id: String, + pub height: Option, + pub visibility: Option, + pub cell_by_field_id: HashMap, +} + +impl std::convert::From for RowMetaChangeset { + fn from(changeset: CellChangeset) -> Self { + let mut cell_by_field_id = HashMap::with_capacity(1); + let field_id = changeset.field_id; + let cell_rev = CellRevision { + data: changeset.cell_content_changeset.unwrap_or_else(|| "".to_owned()), + }; + cell_by_field_id.insert(field_id, cell_rev); + + RowMetaChangeset { + row_id: changeset.row_id, + height: None, + visibility: None, + cell_by_field_id, + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] +pub struct CellRevision { + pub data: String, +} + +impl CellRevision { + pub fn new(data: String) -> Self { + Self { data } + } +} + +#[derive(Clone, Default, Deserialize, Serialize)] +pub struct BuildGridContext { + pub field_revs: Vec, + pub blocks: Vec, + pub blocks_meta_data: Vec, +} + +impl BuildGridContext { + pub fn new() -> Self { + Self::default() + } +} + +impl std::convert::From for Bytes { + fn from(ctx: BuildGridContext) -> Self { + let bytes = serde_json::to_vec(&ctx).unwrap_or_else(|_| vec![]); + Bytes::from(bytes) + } +} + +impl std::convert::TryFrom for BuildGridContext { + type Error = serde_json::Error; + + fn try_from(bytes: Bytes) -> Result { + let ctx: BuildGridContext = serde_json::from_slice(&bytes)?; + Ok(ctx) + } +} diff --git a/shared-lib/flowy-grid-data-model/src/revision/mod.rs b/shared-lib/flowy-grid-data-model/src/revision/mod.rs index a667d3c587..da6b857db6 100644 --- a/shared-lib/flowy-grid-data-model/src/revision/mod.rs +++ b/shared-lib/flowy-grid-data-model/src/revision/mod.rs @@ -1,296 +1,5 @@ -use crate::entities::{CellChangeset, Field, FieldOrder, FieldType, RowOrder}; -use bytes::Bytes; -use indexmap::IndexMap; -use nanoid::nanoid; -use serde::{Deserialize, Serialize}; -use std::any::Any; -use std::collections::HashMap; -use std::sync::Arc; +mod grid_info_rev; +mod grid_rev; -pub const DEFAULT_ROW_HEIGHT: i32 = 42; - -pub fn gen_grid_id() -> String { - // nanoid calculator https://zelark.github.io/nano-id-cc/ - nanoid!(10) -} - -pub fn gen_block_id() -> String { - nanoid!(10) -} - -pub fn gen_row_id() -> String { - nanoid!(6) -} - -pub fn gen_field_id() -> String { - nanoid!(6) -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct GridRevision { - pub grid_id: String, - pub fields: Vec, - pub blocks: Vec, -} - -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub struct GridBlockRevision { - pub block_id: String, - pub start_row_index: i32, - pub row_count: i32, -} - -impl GridBlockRevision { - pub fn len(&self) -> i32 { - self.row_count - } - - pub fn is_empty(&self) -> bool { - self.row_count == 0 - } -} - -impl GridBlockRevision { - pub fn new() -> Self { - GridBlockRevision { - block_id: gen_block_id(), - ..Default::default() - } - } -} - -pub struct GridBlockRevisionChangeset { - pub block_id: String, - pub start_row_index: Option, - pub row_count: Option, -} - -impl GridBlockRevisionChangeset { - pub fn from_row_count(block_id: &str, row_count: i32) -> Self { - Self { - block_id: block_id.to_string(), - start_row_index: None, - row_count: Some(row_count), - } - } -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct GridBlockRevisionData { - pub block_id: String, - pub rows: Vec, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq)] -pub struct FieldRevision { - pub id: String, - - pub name: String, - - pub desc: String, - - pub field_type: FieldType, - - pub frozen: bool, - - pub visibility: bool, - - pub width: i32, - - /// type_options contains key/value pairs - /// key: id of the FieldType - /// value: type option data that can be parsed into specified TypeOptionStruct. - /// For example, CheckboxTypeOption, MultiSelectTypeOption etc. - #[serde(with = "indexmap::serde_seq")] - pub type_options: IndexMap, - - #[serde(default = "default_is_primary")] - pub is_primary: bool, -} - -fn default_is_primary() -> bool { - false -} - -impl FieldRevision { - pub fn new(name: &str, desc: &str, field_type: FieldType, is_primary: bool) -> Self { - let width = field_type.default_cell_width(); - Self { - id: gen_field_id(), - name: name.to_string(), - desc: desc.to_string(), - field_type, - frozen: false, - visibility: true, - width, - type_options: Default::default(), - is_primary, - } - } - - pub fn insert_type_option_entry(&mut self, entry: &T) - where - T: TypeOptionDataEntry + ?Sized, - { - self.type_options.insert(entry.field_type().type_id(), entry.json_str()); - } - - pub fn get_type_option_entry(&self, field_type: &FieldType) -> Option { - self.type_options - .get(&field_type.type_id()) - .map(|s| T::from_json_str(s)) - } - - pub fn insert_type_option_str(&mut self, field_type: &FieldType, json_str: String) { - self.type_options.insert(field_type.type_id(), json_str); - } - - pub fn get_type_option_str(&self, field_type: &FieldType) -> Option { - self.type_options.get(&field_type.type_id()).map(|s| s.to_owned()) - } -} - -impl std::convert::From for Field { - fn from(field_rev: FieldRevision) -> Self { - Self { - id: field_rev.id, - name: field_rev.name, - desc: field_rev.desc, - field_type: field_rev.field_type, - frozen: field_rev.frozen, - visibility: field_rev.visibility, - width: field_rev.width, - is_primary: field_rev.is_primary, - } - } -} - -impl std::convert::From<&FieldRevision> for FieldOrder { - fn from(field_rev: &FieldRevision) -> Self { - Self { - field_id: field_rev.id.clone(), - } - } -} - -pub trait TypeOptionDataEntry { - fn field_type(&self) -> FieldType; - fn json_str(&self) -> String; - fn protobuf_bytes(&self) -> Bytes; -} - -pub trait TypeOptionDataDeserializer { - fn from_json_str(s: &str) -> Self; - fn from_protobuf_bytes(bytes: Bytes) -> Self; -} - -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub struct RowRevision { - pub id: String, - pub block_id: String, - /// cells contains key/value pairs. - /// key: field id, - /// value: CellMeta - #[serde(with = "indexmap::serde_seq")] - pub cells: IndexMap, - pub height: i32, - pub visibility: bool, -} - -impl RowRevision { - pub fn new(block_id: &str) -> Self { - Self { - id: gen_row_id(), - block_id: block_id.to_owned(), - cells: Default::default(), - height: DEFAULT_ROW_HEIGHT, - visibility: true, - } - } -} - -impl std::convert::From<&RowRevision> for RowOrder { - fn from(row: &RowRevision) -> Self { - Self { - row_id: row.id.clone(), - block_id: row.block_id.clone(), - height: row.height, - } - } -} - -impl std::convert::From<&Arc> for RowOrder { - fn from(row: &Arc) -> Self { - Self { - row_id: row.id.clone(), - block_id: row.block_id.clone(), - height: row.height, - } - } -} - -#[derive(Debug, Clone, Default)] -pub struct RowMetaChangeset { - pub row_id: String, - pub height: Option, - pub visibility: Option, - pub cell_by_field_id: HashMap, -} - -impl std::convert::From for RowMetaChangeset { - fn from(changeset: CellChangeset) -> Self { - let mut cell_by_field_id = HashMap::with_capacity(1); - let field_id = changeset.field_id; - let cell_rev = CellRevision { - data: changeset.cell_content_changeset.unwrap_or_else(|| "".to_owned()), - }; - cell_by_field_id.insert(field_id, cell_rev); - - RowMetaChangeset { - row_id: changeset.row_id, - height: None, - visibility: None, - cell_by_field_id, - } - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] -pub struct CellRevision { - pub data: String, -} - -impl CellRevision { - pub fn new(data: String) -> Self { - Self { data } - } -} - -#[derive(Clone, Default, Deserialize, Serialize)] -pub struct BuildGridContext { - pub field_revs: Vec, - pub blocks: Vec, - pub blocks_meta_data: Vec, -} - -impl BuildGridContext { - pub fn new() -> Self { - Self::default() - } -} - -impl std::convert::From for Bytes { - fn from(ctx: BuildGridContext) -> Self { - let bytes = serde_json::to_vec(&ctx).unwrap_or_else(|_| vec![]); - Bytes::from(bytes) - } -} - -impl std::convert::TryFrom for BuildGridContext { - type Error = serde_json::Error; - - fn try_from(bytes: Bytes) -> Result { - let ctx: BuildGridContext = serde_json::from_slice(&bytes)?; - Ok(ctx) - } -} +pub use grid_info_rev::*; +pub use grid_rev::*; diff --git a/shared-lib/flowy-grid-data-model/tests/serde_test.rs b/shared-lib/flowy-grid-data-model/tests/serde_test.rs index 62e5b13197..b544e10588 100644 --- a/shared-lib/flowy-grid-data-model/tests/serde_test.rs +++ b/shared-lib/flowy-grid-data-model/tests/serde_test.rs @@ -3,11 +3,7 @@ use flowy_grid_data_model::revision::*; #[test] fn grid_default_serde_test() { let grid_id = "1".to_owned(); - let grid = GridRevision { - grid_id, - fields: vec![], - blocks: vec![], - }; + let grid = GridRevision::new(&grid_id); let json = serde_json::to_string(&grid).unwrap(); assert_eq!(json, r#"{"grid_id":"1","fields":[],"blocks":[]}"#) diff --git a/shared-lib/flowy-sync/src/client_grid/grid_builder.rs b/shared-lib/flowy-sync/src/client_grid/grid_builder.rs index ae68f0a5fa..101acf594e 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_builder.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_builder.rs @@ -79,6 +79,7 @@ mod tests { grid_id, fields: build_context.field_revs, blocks: build_context.blocks, + info: Default::default(), }; let grid_meta_delta = make_grid_delta(&grid_rev); diff --git a/shared-lib/flowy-sync/src/client_grid/grid_revision_pad.rs b/shared-lib/flowy-sync/src/client_grid/grid_revision_pad.rs index 3173612896..98a5fe9f58 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_revision_pad.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_revision_pad.rs @@ -7,7 +7,6 @@ use flowy_grid_data_model::entities::{FieldChangesetParams, FieldOrder}; use flowy_grid_data_model::revision::{ gen_block_id, gen_grid_id, FieldRevision, GridBlockRevision, GridBlockRevisionChangeset, GridRevision, }; -use futures::StreamExt; use lib_infra::util::move_vec_element; use lib_ot::core::{OperationTransformable, PlainTextAttributes, PlainTextDelta, PlainTextDeltaBuilder}; use std::collections::HashMap; @@ -423,11 +422,7 @@ pub fn make_grid_revisions(user_id: &str, grid_rev: &GridRevision) -> RepeatedRe impl std::default::Default for GridRevisionPad { fn default() -> Self { - let grid = GridRevision { - grid_id: gen_grid_id(), - fields: vec![], - blocks: vec![], - }; + let grid = GridRevision::new(&gen_grid_id()); let delta = make_grid_delta(&grid); GridRevisionPad { grid_rev: Arc::new(grid),