Feat: add appflowy editor in backend (#1320)

* chore: remove update attributes

* chore: format code

* chore: extension for transaction

* refactor: add document editor trait

* chore: add appflowy_document editor

* chore: add document serde

* chore: add new document editor

* chore: add tests

* chore: add more test

* chore: add test

Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
Nathan.fooo
2022-10-20 11:35:11 +08:00
committed by GitHub
parent 833a6cd95f
commit f1a5726fcb
81 changed files with 2367 additions and 902 deletions

View File

@ -22,8 +22,7 @@ pub fn parse_protobuf_context_from(crate_paths: Vec<String>) -> Vec<ProtobufCrat
let files = crate_info
.proto_input_paths()
.iter()
.map(|proto_crate_path| parse_files_protobuf(proto_crate_path, &proto_output_path))
.flatten()
.flat_map(|proto_crate_path| parse_files_protobuf(proto_crate_path, &proto_output_path))
.collect::<Vec<ProtoFile>>();
ProtobufCrateContext::from_crate_info(crate_info, files)

View File

@ -182,9 +182,9 @@ pub fn check_pb_dart_plugin() {
));
}
msg.push_str(&"✅ You can fix that by adding:".to_string());
msg.push_str(&"\n\texport PATH=\"$PATH\":\"$HOME/.pub-cache/bin\"\n".to_string());
msg.push_str(&"to your shell's config file.(.bashrc, .bash, .profile, .zshrc etc.)".to_string());
msg.push_str("✅ You can fix that by adding:");
msg.push_str("\n\texport PATH=\"$PATH\":\"$HOME/.pub-cache/bin\"\n");
msg.push_str("to your shell's config file.(.bashrc, .bash, .profile, .zshrc etc.)");
panic!("{}", msg)
}
}
@ -198,13 +198,9 @@ fn gen_proto_files(crate_name: &str, crate_path: &str) -> Vec<ProtobufCrate> {
.map(|info| info.protobuf_crate.clone())
.collect::<Vec<_>>();
crate_context
.into_iter()
.map(|info| info.files)
.flatten()
.for_each(|file| {
println!("cargo:rerun-if-changed={}", file.file_path);
});
crate_context.into_iter().flat_map(|info| info.files).for_each(|file| {
println!("cargo:rerun-if-changed={}", file.file_path);
});
proto_crates
}

View File

@ -52,7 +52,7 @@ impl ProtoGenerator {
fn write_proto_files(crate_contexts: &[ProtobufCrateContext]) {
let file_path_content_map = crate_contexts
.iter()
.map(|ctx| {
.flat_map(|ctx| {
ctx.files
.iter()
.map(|file| {
@ -66,7 +66,6 @@ fn write_proto_files(crate_contexts: &[ProtobufCrateContext]) {
})
.collect::<HashMap<String, ProtoFileSymbol>>()
})
.flatten()
.collect::<HashMap<String, ProtoFileSymbol>>();
for context in crate_contexts {
@ -152,12 +151,11 @@ impl ProtoCache {
fn from_crate_contexts(crate_contexts: &[ProtobufCrateContext]) -> Self {
let proto_files = crate_contexts
.iter()
.map(|crate_info| &crate_info.files)
.flatten()
.flat_map(|crate_info| &crate_info.files)
.collect::<Vec<&ProtoFile>>();
let structs: Vec<String> = proto_files.iter().map(|info| info.structs.clone()).flatten().collect();
let enums: Vec<String> = proto_files.iter().map(|info| info.enums.clone()).flatten().collect();
let structs: Vec<String> = proto_files.iter().flat_map(|info| info.structs.clone()).collect();
let enums: Vec<String> = proto_files.iter().flat_map(|info| info.enums.clone()).collect();
Self { structs, enums }
}
}