import { UpdateExceptionListItemSchema } from '../update_exception_list_item_schema' ; export const validateComments = ( item ) : string [ ] => { if ( item . comments == null ) { return [ ] ; } const [ appendOnly ] = item . comments . reduce ( ( acc , comment ) => { const [ , hasNewComments ] = acc ; if ( comment . id == null ) { return [ true , true ] ; } if ( hasNewComments && comment . id != null ) { return [ false , true ] ; } return acc ; } , [ true , false ] ) ; if ( ! appendOnly ) { return [ 'item "comments" are append only' ] ; } else { return [ ] ; } } ; export const updateExceptionListItemValidate = ( schema ) : string [ ] => { return [ ... validateComments ( schema ) ] ; } ;