import { SavedObject } from 'kibana/server' ; import { getRuleExecutionStatusPending } from '../lib/rule_execution_status' ; import { RawRule } from '../types' ; export function transformRulesForExport ( rules ) { const exportDate = new Date ( ) . toISOString ( ) ; return rules . map ( ( rule ) => transformRuleForExport ( rule as SavedObject < RawRule > , exportDate ) ) ; } function transformRuleForExport ( rule , exportDate ) { return { ... rule , attributes : { ... rule . attributes , legacyId : null , enabled : false , apiKey : null , apiKeyOwner : null , scheduledTaskId : null , executionStatus : getRuleExecutionStatusPending ( exportDate ) , } , } ; }