import EntityTypeMap from "../entity-store/EntityTypeMap" ; import AuditLog from "./AuditLog" ; interface EntityTypeMapAudtiorConfig { auditLog : AuditLog ; } enum EntityTypeMapAuditorEvent { Write = "Write" , Evict = "Evict" } export default class EntityTypeMapAudtior extends EntityTypeMap { private auditLog : AuditLog ; constructor ( config ) { super ( ) ; this . auditLog = config . auditLog ; } write ( typename , dataId , storeFieldName ? , variables ? ) { this . auditLog . log ( "Writing to type map" , EntityTypeMapAuditorEvent . Write , "EntityTypeMap" , { typename , dataId , storeFieldName , variables , } ) ; return super . write ( typename , dataId , storeFieldName , variables ) ; } evict ( dataId , storeFieldName ? ) { this . auditLog . log ( "Evicting from type map" , EntityTypeMapAuditorEvent . Evict , "EntityTypeMap" , { dataId , storeFieldName , } ) ; return super . evict ( dataId , storeFieldName ) ; } }