import { PluginRevertAction , PluginInstance , PluginRevertActionPayload } from '@magnetarjs/core' ; import { FirestoreModuleConfig , FirestorePluginOptions } from '../CreatePlugin' ; export function revertActionFactory ( actions , firestorePluginOptions ) { return async function ( { payload , collectionPath , docId , actionConfig , pluginModuleConfig , actionName , error , } ) : Promise < void > { const isReadAction = [ 'fetch' , 'stream' ] . includes ( actionName ) ; if ( isReadAction ) return ; if ( docId ) { if ( actionName === 'insert' ) { if ( actions . delete ) await actions . delete ( { payload : undefined , collectionPath , docId , actionConfig , pluginModuleConfig , } ) ; return ; } } } ; }