pub async fn check_app_entry_type(
    entry_type: &AppEntryType,
    conductor_api: &impl CellConductorApiT,
) -> SysValidationResult<EntryDef> {
    let zome_index = u8::from(entry_type.zome_id()) as usize;
    // We want to be careful about holding locks open to the conductor api
    // so calls are made in blocks
    let dna_file = conductor_api.get_this_dna().await.map_err(Box::new)?;

    // Check if the zome is found
    let zome = dna_file
        .dna()
        .zomes
        .get(zome_index)
        .ok_or_else(|| ValidationOutcome::ZomeId(entry_type.clone()))?
        .clone()
        .1;

    let entry_def = get_entry_def(entry_type.id(), zome, dna_file.dna(), conductor_api).await?;

    // Check the visibility and return
    match entry_def {
        Some(entry_def) => {
            if entry_def.visibility == *entry_type.visibility() {
                Ok(entry_def)
            } else {
                Err(ValidationOutcome::EntryVisibility(entry_type.clone()).into())
            }
        }
        None => Err(ValidationOutcome::EntryDefId(entry_type.clone()).into()),
    }
}
/// Check the AppEntryType is valid for the zome.
/// Check the EntryDefId and ZomeId are in range.
Check the AppEntryType is valid for the zome.
Check the EntryDefId and ZomeId are in range.
Check the AppEntryType is valid for the zome . Check the EntryDefId and ZomeId are in range .
pub async fn check_app_entry_type(
    entry_type: &AppEntryType,
    conductor_api: &impl CellConductorApiT,
) -> SysValidationResult<EntryDef> {
    let zome_index = u8::from(entry_type.zome_id()) as usize;
    // We want to be careful about holding locks open to the conductor api
    // so calls are made in blocks
    let dna_file = conductor_api.get_this_dna().await.map_err(Box::new)?;
    // Check if the zome is found
    let zome = dna_file
        .dna()
        .zomes
        .get(zome_index)
        .ok_or_else(|| ValidationOutcome::ZomeId(entry_type.clone()))?
        .clone()
        .1;
    let entry_def = get_entry_def(entry_type.id(), zome, dna_file.dna(), conductor_api).await?;
    // Check the visibility and return
    match entry_def {
        Some(entry_def) => {
            if entry_def.visibility == *entry_type.visibility() {
                Ok(entry_def)
            } else {
                Err(ValidationOutcome::EntryVisibility(entry_type.clone()).into())
            }
        }
        None => Err(ValidationOutcome::EntryDefId(entry_type.clone()).into()),
    }
}
pub async fn check_app_entry_type ( entry_type : & AppEntryType , conductor_api : & impl CellConductorApiT , ) -> SysValidationResult < EntryDef > { let zome_index = u8 :: from ( entry_type . zome_id ( ) ) as usize ; // We want to be careful about holding locks open to the conductor api // so calls are made in blocks let dna_file = conductor_api . get_this_dna ( ) . await . map_err ( Box :: new ) ? ; // Check if the zome is found let zome = dna_file . dna ( ) . zomes . get ( zome_index ) . ok_or_else ( | | ValidationOutcome :: ZomeId ( entry_type . clone ( ) ) ) ? . clone ( ) . 1 ; let entry_def = get_entry_def ( entry_type . id ( ) , zome , dna_file . dna ( ) , conductor_api ) . await ? ; // Check the visibility and return match entry_def { Some ( entry_def ) => { if entry_def . visibility == * entry_type . visibility ( ) { Ok ( entry_def ) } else { Err ( ValidationOutcome :: EntryVisibility ( entry_type . clone ( ) ) . into ( ) ) } } None => Err ( ValidationOutcome :: EntryDefId ( entry_type . clone ( ) ) . into ( ) ) , } }
Check the AppEntryType is valid for the zome.
Check the AppEntryType is valid for the zome .
entry_type
&AppEntryType
conductor_api
&impl CellConductorApiT
entry_type
&AppEntryType
conductor_api
&impl CellConductorApiT