import { AlertActionParams , AlertInstanceState , AlertInstanceContext , AlertTypeParams , } from '../types' ; import { PluginStartContract as ActionsPluginStartContract } from '../../../actions/server' ; interface TransformActionParamsOptions { actionsPlugin : ActionsPluginStartContract ; alertId : string ; alertType : string ; actionId : string ; actionTypeId : string ; alertName : string ; spaceId : string ; tags ? : string [ ] ; alertInstanceId : string ; alertActionGroup : string ; alertActionGroupName : string ; alertActionSubgroup ? : string ; actionParams : AlertActionParams ; alertParams : AlertTypeParams ; state : AlertInstanceState ; kibanaBaseUrl ? : string ; context : AlertInstanceContext ; } export function transformActionParams ( { actionsPlugin , alertId , alertType , actionId , actionTypeId , alertName , spaceId , tags , alertInstanceId , alertActionGroup , alertActionSubgroup , alertActionGroupName , context , actionParams , state , kibanaBaseUrl , alertParams , } ) { const variables = { alertId , alertName , spaceId , tags , alertInstanceId , alertActionGroup , alertActionGroupName , alertActionSubgroup , context , date : new Date ( ) . toISOString ( ) , state , kibanaBaseUrl , params : alertParams , rule : { id : alertId , name : alertName , type : alertType , spaceId , tags , } , alert : { id : alertInstanceId , actionGroup : alertActionGroup , actionGroupName : alertActionGroupName , actionSubgroup : alertActionSubgroup , } , } ; return actionsPlugin . renderActionParameterTemplates ( actionTypeId , actionId , actionParams , variables ) ; }