Переглянути джерело

chore: ignore shared-lib proto files

appflowy 2 роки тому
батько
коміт
d4678f6233
23 змінених файлів з 13 додано та 642 видалено
  1. 2 1
      .gitignore
  2. 0 6
      frontend/rust-lib/dart-ffi/resources/proto/ffi_request.proto
  3. 0 11
      frontend/rust-lib/dart-ffi/resources/proto/ffi_response.proto
  4. 0 48
      shared-lib/flowy-error-code/resources/proto/code.proto
  5. 0 48
      shared-lib/flowy-folder-data-model/resources/proto/app.proto
  6. 0 25
      shared-lib/flowy-folder-data-model/resources/proto/trash.proto
  7. 0 65
      shared-lib/flowy-folder-data-model/resources/proto/view.proto
  8. 0 13
      shared-lib/flowy-folder-data-model/resources/proto/view_info.proto
  9. 0 40
      shared-lib/flowy-folder-data-model/resources/proto/workspace.proto
  10. 0 86
      shared-lib/flowy-grid-data-model/resources/proto/field.proto
  11. 0 86
      shared-lib/flowy-grid-data-model/resources/proto/grid.proto
  12. 0 22
      shared-lib/flowy-grid-data-model/resources/proto/grid_info.proto
  13. 0 8
      shared-lib/flowy-sync/resources/proto/folder_info.proto
  14. 0 25
      shared-lib/flowy-sync/resources/proto/revision.proto
  15. 0 30
      shared-lib/flowy-sync/resources/proto/text_block_info.proto
  16. 0 29
      shared-lib/flowy-sync/resources/proto/ws_data.proto
  17. 0 34
      shared-lib/flowy-user-data-model/resources/proto/auth.proto
  18. 0 23
      shared-lib/flowy-user-data-model/resources/proto/user_profile.proto
  19. 0 15
      shared-lib/flowy-user-data-model/resources/proto/user_setting.proto
  20. 10 4
      shared-lib/lib-infra/src/code_gen/protobuf_file/proto_gen.rs
  21. 1 1
      shared-lib/lib-infra/src/code_gen/protobuf_file/proto_info.rs
  22. 0 11
      shared-lib/lib-ws/resources/proto/errors.proto
  23. 0 11
      shared-lib/lib-ws/resources/proto/msg.proto

+ 2 - 1
.gitignore

@@ -19,4 +19,5 @@ node_modules
 **/.cache
 **/.DS_Store
 
-**/src/protobuf
+**/src/protobuf
+**/resources/proto

+ 0 - 6
frontend/rust-lib/dart-ffi/resources/proto/ffi_request.proto

@@ -1,6 +0,0 @@
-syntax = "proto3";
-
-message FFIRequest {
-    string event = 1;
-    bytes payload = 2;
-}

+ 0 - 11
frontend/rust-lib/dart-ffi/resources/proto/ffi_response.proto

@@ -1,11 +0,0 @@
-syntax = "proto3";
-
-message FFIResponse {
-    bytes payload = 1;
-    FFIStatusCode code = 2;
-}
-enum FFIStatusCode {
-    Ok = 0;
-    Err = 1;
-    Internal = 2;
-}

+ 0 - 48
shared-lib/flowy-error-code/resources/proto/code.proto

@@ -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;
-}

+ 0 - 48
shared-lib/flowy-folder-data-model/resources/proto/app.proto

@@ -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; };
-}

+ 0 - 25
shared-lib/flowy-folder-data-model/resources/proto/trash.proto

@@ -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;
-}

+ 0 - 65
shared-lib/flowy-folder-data-model/resources/proto/view.proto

@@ -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;
-}

+ 0 - 13
shared-lib/flowy-folder-data-model/resources/proto/view_info.proto

@@ -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;
-}

+ 0 - 40
shared-lib/flowy-folder-data-model/resources/proto/workspace.proto

@@ -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; };
-}

+ 0 - 86
shared-lib/flowy-grid-data-model/resources/proto/field.proto

@@ -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;
-}

+ 0 - 86
shared-lib/flowy-grid-data-model/resources/proto/grid.proto

@@ -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<string, Cell> 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;
-}

+ 0 - 22
shared-lib/flowy-grid-data-model/resources/proto/grid_info.proto

@@ -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; };
-}

+ 0 - 8
shared-lib/flowy-sync/resources/proto/folder_info.proto

@@ -1,8 +0,0 @@
-syntax = "proto3";
-
-message FolderInfo {
-    string folder_id = 1;
-    string text = 2;
-    int64 rev_id = 3;
-    int64 base_rev_id = 4;
-}

+ 0 - 25
shared-lib/flowy-sync/resources/proto/revision.proto

@@ -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;
-}

+ 0 - 30
shared-lib/flowy-sync/resources/proto/text_block_info.proto

@@ -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;
-}

+ 0 - 29
shared-lib/flowy-sync/resources/proto/ws_data.proto

@@ -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;
-}

+ 0 - 34
shared-lib/flowy-user-data-model/resources/proto/auth.proto

@@ -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;
-}

+ 0 - 23
shared-lib/flowy-user-data-model/resources/proto/user_profile.proto

@@ -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; };
-}

+ 0 - 15
shared-lib/flowy-user-data-model/resources/proto/user_setting.proto

@@ -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;
-}

+ 10 - 4
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, ProtoFileSymbol>) -> String {
-    let mut import_content = String::new();
+    let mut import_files: Vec<String> = vec![];
     file_path_symbols_map
         .iter()
         .for_each(|(file_path, proto_file_symbols)| {
             if file_path != &current_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 {

+ 1 - 1
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<String>,
-
+    // store the type of current file using
     pub ref_types: Vec<String>,
 
     pub enums: Vec<String>,

+ 0 - 11
shared-lib/lib-ws/resources/proto/errors.proto

@@ -1,11 +0,0 @@
-syntax = "proto3";
-
-message WSError {
-    ErrorCode code = 1;
-    string msg = 2;
-}
-enum ErrorCode {
-    InternalError = 0;
-    UnsupportedMessage = 1;
-    Unauthorized = 2;
-}

+ 0 - 11
shared-lib/lib-ws/resources/proto/msg.proto

@@ -1,11 +0,0 @@
-syntax = "proto3";
-
-message WebSocketRawMessage {
-    WSChannel channel = 1;
-    bytes data = 2;
-}
-enum WSChannel {
-    Document = 0;
-    Folder = 1;
-    Grid = 2;
-}