use std::collections::BTreeMap;
use std::path::Path;
use crate::NodeId;
use super::manifest::FaceManifest;
use super::validation::{authoring_namespace, rule_path_for_source};
impl FaceManifest {
pub(crate) fn new(
name: &str,
kind: &str,
parent: NodeId,
parent_source: &str,
parent_kind: &str,
source: &str,
) -> Self {
let mut values = BTreeMap::new();
let namespace = authoring_namespace();
for (key, value) in [
("namespace", namespace.as_str()),
("module", name),
("registry_name", name),
("kind", kind),
("preset", "NoPreset"),
("parts", "NoParts"),
("handle", kind),
("registration_rule", "ANY"),
("admission", "ANY"),
("source", source),
("parent_node", &parent.to_string()),
("parent_source", parent_source),
("parent_kind", parent_kind),
("name_zh", ""),
("name_en", ""),
("summary_zh", ""),
("summary_en", ""),
("params", ""),
("stable_name", ""),
("exports", ""),
("provides", ""),
("needs_registry", "false"),
("getting_from_other_registry", ""),
("handle_traits", ""),
("handle_contracts", ""),
("part_traits", ""),
("part_contracts", ""),
("requires", ""),
("runtime_checks", ""),
("flow", ""),
("flow_provider", ""),
] {
values.insert(key.to_owned(), value.to_owned());
}
values.insert(
"registry_rule_path".to_owned(),
rule_path_for_source(source),
);
values.insert("provided_parts".to_owned(), String::new());
values.insert("required_parts".to_owned(), String::new());
Self { values }
}
pub(super) fn parse_source(path: &Path) -> Result<Self, String> {
super::manifest::parse::source(path)
}
}
pub use super::external_graft::{
ExternalGraftPlanEntry, ExternalGraftPlanFile, create_external_graft, external_graft_root,
list_external_grafts, read_external_graft, remove_external_graft, rewrite_external_graft,
};
pub use super::operations::{
AuthoringChange, ModuleFacePatch, NewModuleFace, add_module, add_module_from_face,
add_module_with_registration, delete_module, edit_module_face, generated_snapshots,
generated_snapshots_from,
};
pub use super::validation::AuthoringContext;
pub use nichlink::authoring::{FACE_FIELD_COUNT, face_field};