From d4678f623318dc3fba64a490bf77953e6e1fe02a Mon Sep 17 00:00:00 2001 From: appflowy Date: Fri, 17 Jun 2022 16:53:58 +0800 Subject: [PATCH] chore: ignore shared-lib proto files --- .gitignore | 3 +- .../resources/proto/ffi_request.proto | 6 -- .../resources/proto/ffi_response.proto | 11 --- .../resources/proto/code.proto | 48 ----------- .../resources/proto/app.proto | 48 ----------- .../resources/proto/trash.proto | 25 ------ .../resources/proto/view.proto | 65 -------------- .../resources/proto/view_info.proto | 13 --- .../resources/proto/workspace.proto | 40 --------- .../resources/proto/field.proto | 86 ------------------- .../resources/proto/grid.proto | 86 ------------------- .../resources/proto/grid_info.proto | 22 ----- .../resources/proto/folder_info.proto | 8 -- .../flowy-sync/resources/proto/revision.proto | 25 ------ .../resources/proto/text_block_info.proto | 30 ------- .../flowy-sync/resources/proto/ws_data.proto | 29 ------- .../resources/proto/auth.proto | 34 -------- .../resources/proto/user_profile.proto | 23 ----- .../resources/proto/user_setting.proto | 15 ---- .../src/code_gen/protobuf_file/proto_gen.rs | 14 ++- .../src/code_gen/protobuf_file/proto_info.rs | 2 +- .../lib-ws/resources/proto/errors.proto | 11 --- shared-lib/lib-ws/resources/proto/msg.proto | 11 --- 23 files changed, 13 insertions(+), 642 deletions(-) delete mode 100644 frontend/rust-lib/dart-ffi/resources/proto/ffi_request.proto delete mode 100644 frontend/rust-lib/dart-ffi/resources/proto/ffi_response.proto delete mode 100644 shared-lib/flowy-error-code/resources/proto/code.proto delete mode 100644 shared-lib/flowy-folder-data-model/resources/proto/app.proto delete mode 100644 shared-lib/flowy-folder-data-model/resources/proto/trash.proto delete mode 100644 shared-lib/flowy-folder-data-model/resources/proto/view.proto delete mode 100644 shared-lib/flowy-folder-data-model/resources/proto/view_info.proto delete mode 100644 shared-lib/flowy-folder-data-model/resources/proto/workspace.proto delete mode 100644 shared-lib/flowy-grid-data-model/resources/proto/field.proto delete mode 100644 shared-lib/flowy-grid-data-model/resources/proto/grid.proto delete mode 100644 shared-lib/flowy-grid-data-model/resources/proto/grid_info.proto delete mode 100644 shared-lib/flowy-sync/resources/proto/folder_info.proto delete mode 100644 shared-lib/flowy-sync/resources/proto/revision.proto delete mode 100644 shared-lib/flowy-sync/resources/proto/text_block_info.proto delete mode 100644 shared-lib/flowy-sync/resources/proto/ws_data.proto delete mode 100644 shared-lib/flowy-user-data-model/resources/proto/auth.proto delete mode 100644 shared-lib/flowy-user-data-model/resources/proto/user_profile.proto delete mode 100644 shared-lib/flowy-user-data-model/resources/proto/user_setting.proto delete mode 100644 shared-lib/lib-ws/resources/proto/errors.proto delete mode 100644 shared-lib/lib-ws/resources/proto/msg.proto diff --git a/.gitignore b/.gitignore index 566151d549..af41db7ae0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ node_modules **/.cache **/.DS_Store -**/src/protobuf \ No newline at end of file +**/src/protobuf +**/resources/proto \ No newline at end of file diff --git a/frontend/rust-lib/dart-ffi/resources/proto/ffi_request.proto b/frontend/rust-lib/dart-ffi/resources/proto/ffi_request.proto deleted file mode 100644 index cd71b7b1ed..0000000000 --- a/frontend/rust-lib/dart-ffi/resources/proto/ffi_request.proto +++ /dev/null @@ -1,6 +0,0 @@ -syntax = "proto3"; - -message FFIRequest { - string event = 1; - bytes payload = 2; -} diff --git a/frontend/rust-lib/dart-ffi/resources/proto/ffi_response.proto b/frontend/rust-lib/dart-ffi/resources/proto/ffi_response.proto deleted file mode 100644 index e009e98c21..0000000000 --- a/frontend/rust-lib/dart-ffi/resources/proto/ffi_response.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -message FFIResponse { - bytes payload = 1; - FFIStatusCode code = 2; -} -enum FFIStatusCode { - Ok = 0; - Err = 1; - Internal = 2; -} diff --git a/shared-lib/flowy-error-code/resources/proto/code.proto b/shared-lib/flowy-error-code/resources/proto/code.proto deleted file mode 100644 index ede9b65657..0000000000 --- a/shared-lib/flowy-error-code/resources/proto/code.proto +++ /dev/null @@ -1,48 +0,0 @@ -syntax = "proto3"; -enum ErrorCode { - Internal = 0; - UserUnauthorized = 2; - RecordNotFound = 3; - UserIdIsEmpty = 4; - WorkspaceNameInvalid = 100; - WorkspaceIdInvalid = 101; - AppColorStyleInvalid = 102; - WorkspaceDescTooLong = 103; - WorkspaceNameTooLong = 104; - AppIdInvalid = 110; - AppNameInvalid = 111; - ViewNameInvalid = 120; - ViewThumbnailInvalid = 121; - ViewIdInvalid = 122; - ViewDescTooLong = 123; - ViewDataInvalid = 124; - ViewNameTooLong = 125; - ConnectError = 200; - EmailIsEmpty = 300; - EmailFormatInvalid = 301; - EmailAlreadyExists = 302; - PasswordIsEmpty = 303; - PasswordTooLong = 304; - PasswordContainsForbidCharacters = 305; - PasswordFormatInvalid = 306; - PasswordNotMatch = 307; - UserNameTooLong = 308; - UserNameContainForbiddenCharacters = 309; - UserNameIsEmpty = 310; - UserIdInvalid = 311; - UserNotExist = 312; - TextTooLong = 400; - GridIdIsEmpty = 410; - BlockIdIsEmpty = 420; - RowIdIsEmpty = 430; - OptionIdIsEmpty = 431; - FieldIdIsEmpty = 440; - FieldDoesNotExist = 441; - SelectOptionNameIsEmpty = 442; - FieldNotExists = 443; - FieldInvalidOperation = 444; - TypeOptionDataIsEmpty = 450; - InvalidDateTimeFormat = 500; - UnexpectedEmptyString = 999; - InvalidData = 1000; -} diff --git a/shared-lib/flowy-folder-data-model/resources/proto/app.proto b/shared-lib/flowy-folder-data-model/resources/proto/app.proto deleted file mode 100644 index a71bc15a0a..0000000000 --- a/shared-lib/flowy-folder-data-model/resources/proto/app.proto +++ /dev/null @@ -1,48 +0,0 @@ -syntax = "proto3"; - -import "view.proto"; -message App { - string id = 1; - string workspace_id = 2; - string name = 3; - string desc = 4; - RepeatedView belongings = 5; - int64 version = 6; - int64 modified_time = 7; - int64 create_time = 8; -} -message RepeatedApp { - repeated App items = 1; -} -message CreateAppPayload { - string workspace_id = 1; - string name = 2; - string desc = 3; - ColorStyle color_style = 4; -} -message ColorStyle { - string theme_color = 1; -} -message CreateAppParams { - string workspace_id = 1; - string name = 2; - string desc = 3; - ColorStyle color_style = 4; -} -message AppId { - string value = 1; -} -message UpdateAppPayload { - string app_id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_desc { string desc = 3; }; - oneof one_of_color_style { ColorStyle color_style = 4; }; - oneof one_of_is_trash { bool is_trash = 5; }; -} -message UpdateAppParams { - string app_id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_desc { string desc = 3; }; - oneof one_of_color_style { ColorStyle color_style = 4; }; - oneof one_of_is_trash { bool is_trash = 5; }; -} diff --git a/shared-lib/flowy-folder-data-model/resources/proto/trash.proto b/shared-lib/flowy-folder-data-model/resources/proto/trash.proto deleted file mode 100644 index 8db07d992f..0000000000 --- a/shared-lib/flowy-folder-data-model/resources/proto/trash.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; - -message Trash { - string id = 1; - string name = 2; - int64 modified_time = 3; - int64 create_time = 4; - TrashType ty = 5; -} -message RepeatedTrash { - repeated Trash items = 1; -} -message RepeatedTrashId { - repeated TrashId items = 1; - bool delete_all = 2; -} -message TrashId { - string id = 1; - TrashType ty = 2; -} -enum TrashType { - Unknown = 0; - TrashView = 1; - TrashApp = 2; -} diff --git a/shared-lib/flowy-folder-data-model/resources/proto/view.proto b/shared-lib/flowy-folder-data-model/resources/proto/view.proto deleted file mode 100644 index 1c0ec3cfdd..0000000000 --- a/shared-lib/flowy-folder-data-model/resources/proto/view.proto +++ /dev/null @@ -1,65 +0,0 @@ -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 RepeatedView { - repeated View items = 1; -} -message RepeatedViewId { - repeated string items = 1; -} -message CreateViewPayload { - string belong_to_id = 1; - string name = 2; - string desc = 3; - oneof one_of_thumbnail { string thumbnail = 4; }; - ViewDataType data_type = 5; - int32 plugin_type = 6; - bytes data = 7; -} -message CreateViewParams { - string belong_to_id = 1; - string name = 2; - string desc = 3; - string thumbnail = 4; - ViewDataType data_type = 5; - string view_id = 6; - bytes data = 7; - int32 plugin_type = 8; -} -message ViewId { - string value = 1; -} -message UpdateViewPayload { - string view_id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_desc { string desc = 3; }; - oneof one_of_thumbnail { string thumbnail = 4; }; -} -message UpdateViewParams { - string view_id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_desc { string desc = 3; }; - oneof one_of_thumbnail { string thumbnail = 4; }; -} -message MoveFolderItemPayload { - string item_id = 1; - int32 from = 2; - int32 to = 3; - MoveFolderItemType ty = 4; -} -enum ViewDataType { - TextBlock = 0; - Grid = 1; -} -enum MoveFolderItemType { - MoveApp = 0; - MoveView = 1; -} diff --git a/shared-lib/flowy-folder-data-model/resources/proto/view_info.proto b/shared-lib/flowy-folder-data-model/resources/proto/view_info.proto deleted file mode 100644 index fe2f4cc7cc..0000000000 --- a/shared-lib/flowy-folder-data-model/resources/proto/view_info.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; - -import "view.proto"; -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; - string ext_data = 7; -} diff --git a/shared-lib/flowy-folder-data-model/resources/proto/workspace.proto b/shared-lib/flowy-folder-data-model/resources/proto/workspace.proto deleted file mode 100644 index 4c05aa7d24..0000000000 --- a/shared-lib/flowy-folder-data-model/resources/proto/workspace.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -import "app.proto"; -import "view.proto"; -message Workspace { - string id = 1; - string name = 2; - string desc = 3; - RepeatedApp apps = 4; - int64 modified_time = 5; - int64 create_time = 6; -} -message RepeatedWorkspace { - repeated Workspace items = 1; -} -message CreateWorkspacePayload { - string name = 1; - string desc = 2; -} -message CreateWorkspaceParams { - string name = 1; - string desc = 2; -} -message WorkspaceId { - oneof one_of_value { string value = 1; }; -} -message CurrentWorkspaceSetting { - Workspace workspace = 1; - oneof one_of_latest_view { View latest_view = 2; }; -} -message UpdateWorkspaceRequest { - string id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_desc { string desc = 3; }; -} -message UpdateWorkspaceParams { - string id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_desc { string desc = 3; }; -} diff --git a/shared-lib/flowy-grid-data-model/resources/proto/field.proto b/shared-lib/flowy-grid-data-model/resources/proto/field.proto deleted file mode 100644 index c27c8a4f4d..0000000000 --- a/shared-lib/flowy-grid-data-model/resources/proto/field.proto +++ /dev/null @@ -1,86 +0,0 @@ -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/resources/proto/grid.proto b/shared-lib/flowy-grid-data-model/resources/proto/grid.proto deleted file mode 100644 index 8112d9c335..0000000000 --- a/shared-lib/flowy-grid-data-model/resources/proto/grid.proto +++ /dev/null @@ -1,86 +0,0 @@ -syntax = "proto3"; -import "field.proto"; -message Grid { - string id = 1; - repeated FieldOrder field_orders = 2; - repeated GridBlockOrder block_orders = 3; -} -message RowOrder { - string row_id = 1; - string block_id = 2; - int32 height = 3; -} -message Row { - string id = 1; - map cell_by_field_id = 2; - int32 height = 3; -} -message RepeatedRow { - repeated Row items = 1; -} -message RepeatedGridBlock { - repeated GridBlock items = 1; -} -message GridBlockOrder { - string block_id = 1; - repeated RowOrder row_orders = 2; -} -message IndexRowOrder { - RowOrder row_order = 1; - oneof one_of_index { int32 index = 2; }; -} -message UpdatedRowOrder { - RowOrder row_order = 1; - Row row = 2; -} -message GridRowsChangeset { - string block_id = 1; - repeated IndexRowOrder inserted_rows = 2; - repeated RowOrder deleted_rows = 3; - repeated UpdatedRowOrder updated_rows = 4; -} -message GridBlock { - string id = 1; - repeated RowOrder row_orders = 2; -} -message Cell { - string field_id = 1; - bytes data = 2; -} -message RepeatedCell { - repeated Cell items = 1; -} -message CreateGridPayload { - string name = 1; -} -message GridId { - string value = 1; -} -message GridBlockId { - string value = 1; -} -message CreateRowPayload { - string grid_id = 1; - oneof one_of_start_row_id { string start_row_id = 2; }; -} -message QueryGridBlocksPayload { - string grid_id = 1; - repeated GridBlockOrder block_orders = 2; -} -message MoveItemPayload { - string grid_id = 1; - string item_id = 2; - int32 from_index = 3; - int32 to_index = 4; - MoveItemType ty = 5; -} -message CellChangeset { - string grid_id = 1; - string row_id = 2; - string field_id = 3; - oneof one_of_cell_content_changeset { string cell_content_changeset = 4; }; -} -enum MoveItemType { - MoveField = 0; - MoveRow = 1; -} diff --git a/shared-lib/flowy-grid-data-model/resources/proto/grid_info.proto b/shared-lib/flowy-grid-data-model/resources/proto/grid_info.proto deleted file mode 100644 index 7e0780f810..0000000000 --- a/shared-lib/flowy-grid-data-model/resources/proto/grid_info.proto +++ /dev/null @@ -1,22 +0,0 @@ -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-sync/resources/proto/folder_info.proto b/shared-lib/flowy-sync/resources/proto/folder_info.proto deleted file mode 100644 index f89e516f1a..0000000000 --- a/shared-lib/flowy-sync/resources/proto/folder_info.proto +++ /dev/null @@ -1,8 +0,0 @@ -syntax = "proto3"; - -message FolderInfo { - string folder_id = 1; - string text = 2; - int64 rev_id = 3; - int64 base_rev_id = 4; -} diff --git a/shared-lib/flowy-sync/resources/proto/revision.proto b/shared-lib/flowy-sync/resources/proto/revision.proto deleted file mode 100644 index 5e899e9688..0000000000 --- a/shared-lib/flowy-sync/resources/proto/revision.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; - -message Revision { - int64 base_rev_id = 1; - int64 rev_id = 2; - bytes delta_data = 3; - string md5 = 4; - string object_id = 5; - RevType ty = 6; - string user_id = 7; -} -message RepeatedRevision { - repeated Revision items = 1; -} -message RevId { - int64 value = 1; -} -message RevisionRange { - int64 start = 1; - int64 end = 2; -} -enum RevType { - DeprecatedLocal = 0; - DeprecatedRemote = 1; -} diff --git a/shared-lib/flowy-sync/resources/proto/text_block_info.proto b/shared-lib/flowy-sync/resources/proto/text_block_info.proto deleted file mode 100644 index 0bdf0fa485..0000000000 --- a/shared-lib/flowy-sync/resources/proto/text_block_info.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; - -import "revision.proto"; -import "revision.proto"; -message CreateTextBlockParams { - string id = 1; - RepeatedRevision revisions = 2; -} -message TextBlockInfo { - string block_id = 1; - string text = 2; - int64 rev_id = 3; - int64 base_rev_id = 4; -} -message ResetTextBlockParams { - string block_id = 1; - RepeatedRevision revisions = 2; -} -message TextBlockDelta { - string block_id = 1; - string delta_str = 2; -} -message NewDocUser { - string user_id = 1; - int64 rev_id = 2; - string doc_id = 3; -} -message TextBlockId { - string value = 1; -} diff --git a/shared-lib/flowy-sync/resources/proto/ws_data.proto b/shared-lib/flowy-sync/resources/proto/ws_data.proto deleted file mode 100644 index 73ed03a764..0000000000 --- a/shared-lib/flowy-sync/resources/proto/ws_data.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; - -import "revision.proto"; -message ClientRevisionWSData { - string object_id = 1; - ClientRevisionWSDataType ty = 2; - RepeatedRevision revisions = 3; - string data_id = 4; -} -message ServerRevisionWSData { - string object_id = 1; - ServerRevisionWSDataType ty = 2; - bytes data = 3; -} -message NewDocumentUser { - string user_id = 1; - string doc_id = 2; - bytes revision_data = 3; -} -enum ClientRevisionWSDataType { - ClientPushRev = 0; - ClientPing = 1; -} -enum ServerRevisionWSDataType { - ServerAck = 0; - ServerPushRev = 1; - ServerPullRev = 2; - UserConnect = 3; -} diff --git a/shared-lib/flowy-user-data-model/resources/proto/auth.proto b/shared-lib/flowy-user-data-model/resources/proto/auth.proto deleted file mode 100644 index 0c558a56a3..0000000000 --- a/shared-lib/flowy-user-data-model/resources/proto/auth.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto3"; - -message SignInPayload { - string email = 1; - string password = 2; - string name = 3; -} -message SignInParams { - string email = 1; - string password = 2; - string name = 3; -} -message SignInResponse { - string user_id = 1; - string name = 2; - string email = 3; - string token = 4; -} -message SignUpPayload { - string email = 1; - string name = 2; - string password = 3; -} -message SignUpParams { - string email = 1; - string name = 2; - string password = 3; -} -message SignUpResponse { - string user_id = 1; - string name = 2; - string email = 3; - string token = 4; -} diff --git a/shared-lib/flowy-user-data-model/resources/proto/user_profile.proto b/shared-lib/flowy-user-data-model/resources/proto/user_profile.proto deleted file mode 100644 index 9baed718cc..0000000000 --- a/shared-lib/flowy-user-data-model/resources/proto/user_profile.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -message UserToken { - string token = 1; -} -message UserProfile { - string id = 1; - string email = 2; - string name = 3; - string token = 4; -} -message UpdateUserPayload { - string id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_email { string email = 3; }; - oneof one_of_password { string password = 4; }; -} -message UpdateUserParams { - string id = 1; - oneof one_of_name { string name = 2; }; - oneof one_of_email { string email = 3; }; - oneof one_of_password { string password = 4; }; -} diff --git a/shared-lib/flowy-user-data-model/resources/proto/user_setting.proto b/shared-lib/flowy-user-data-model/resources/proto/user_setting.proto deleted file mode 100644 index 958ada4c42..0000000000 --- a/shared-lib/flowy-user-data-model/resources/proto/user_setting.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -message UserPreferences { - string user_id = 1; - AppearanceSettings appearance_setting = 2; -} -message AppearanceSettings { - string theme = 1; - LocaleSettings locale = 2; - bool reset_as_default = 3; -} -message LocaleSettings { - string language_code = 1; - string country_code = 2; -} diff --git a/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_gen.rs b/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_gen.rs index f3fe114c42..ad9c769a1f 100644 --- a/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_gen.rs +++ b/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_gen.rs @@ -89,20 +89,26 @@ fn write_proto_files(crate_contexts: &[ProtobufCrateContext]) { } fn gen_import_content(current_file: &ProtoFile, file_path_symbols_map: &HashMap) -> String { - let mut import_content = String::new(); + let mut import_files: Vec = vec![]; file_path_symbols_map .iter() .for_each(|(file_path, proto_file_symbols)| { if file_path != ¤t_file.file_path { current_file.ref_types.iter().for_each(|ref_type| { if proto_file_symbols.symbols.contains(ref_type) { - import_content.push_str(&format!("import \"{}.proto\";\n", proto_file_symbols.file_name)); + let import_file = format!("import \"{}.proto\";", proto_file_symbols.file_name); + if !import_files.contains(&import_file) { + import_files.push(import_file); + } } }); } }); - - import_content + if import_files.len() == 1 { + format!("{}\n", import_files.pop().unwrap()) + } else { + import_files.join("\n") + } } struct ProtoFileSymbol { diff --git a/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_info.rs b/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_info.rs index d5dcbcaeaa..b4ba5cb432 100644 --- a/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_info.rs +++ b/shared-lib/lib-infra/src/code_gen/protobuf_file/proto_info.rs @@ -106,7 +106,7 @@ pub struct ProtoFile { pub file_path: String, pub file_name: String, pub structs: Vec, - + // store the type of current file using pub ref_types: Vec, pub enums: Vec, diff --git a/shared-lib/lib-ws/resources/proto/errors.proto b/shared-lib/lib-ws/resources/proto/errors.proto deleted file mode 100644 index a2e3ccc45a..0000000000 --- a/shared-lib/lib-ws/resources/proto/errors.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -message WSError { - ErrorCode code = 1; - string msg = 2; -} -enum ErrorCode { - InternalError = 0; - UnsupportedMessage = 1; - Unauthorized = 2; -} diff --git a/shared-lib/lib-ws/resources/proto/msg.proto b/shared-lib/lib-ws/resources/proto/msg.proto deleted file mode 100644 index 9306bd499b..0000000000 --- a/shared-lib/lib-ws/resources/proto/msg.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -message WebSocketRawMessage { - WSChannel channel = 1; - bytes data = 2; -} -enum WSChannel { - Document = 0; - Folder = 1; - Grid = 2; -}