import { ApolloCache } from '@apollo/client/core' ; export interface TriggerFunctionConfig < T > { cache : ApolloCache < T > ; } export default < T > ( { cache } ) => ( persist ) => { const write = cache . write ; const evict = cache . evict ; const modify = cache . modify ; cache . write = ( ... args ) => { const result = write . apply ( cache , args ) ; persist ( ) ; return result ; } ; cache . evict = ( ... args ) => { const result = evict . apply ( cache , args ) ; persist ( ) ; return result ; } ; cache . modify = ( ... args ) => { const result = modify . apply ( cache , args ) ; persist ( ) ; return result ; } ; return ( ) => { cache . write = write ; cache . evict = evict ; cache . modify = modify ; } ; } ;