import { Logger , SavedObject } from 'kibana/server' ; import { RawRule } from '../types' ; import { RuleTypeRegistry } from '../rule_type_registry' ; export function isRuleExportable ( rule , ruleTypeRegistry , logger ) { const ruleSO = rule as SavedObject < RawRule > ; try { const ruleType = ruleTypeRegistry . get ( ruleSO . attributes . alertTypeId ) ; if ( ! ruleType . isExportable ) { logger . warn ( `Skipping export of rule "${ ruleSO . id }" because rule type "${ ruleSO . attributes . alertTypeId }" is not exportable through this interface.` ) ; } return ruleType . isExportable ; } catch ( err ) { logger . warn ( `Skipping export of rule "${ ruleSO . id }" because rule type "${ ruleSO . attributes . alertTypeId }" is not recognized.` ) ; return false ; } }