import type { ResolveRequest , ResolveResponse , ReplicationState , } from '@resolve-js/core' ; const handler = async ( req , res ) => { try { const result = await req . resolve . eventstoreAdapter . getReplicationState ( ) ; if ( req . query [ 'extra' ] !== undefined ) { const description = await req . resolve . eventstoreAdapter . describe ( ) ; result . totalEventCount = description . eventCount ; result . totalSecretCount = description . secretCount ; } res . json ( result ) ; } catch ( error ) { const result = { statusAndData : { status : 'serviceError' , data : { name : error . name , message : error . message , } , } , iterator : null , successEvent : null , paused : false , locked : false , lockId : null , } ; res . json ( result ) ; } } ; export default handler ;