import { CodeGenDirective , CodeGenField , CodeGenModel } from '../visitors/appsync-visitor' ; export function addFieldToModel ( model , field ) { const existingField = model . fields . find ( f => f . name === field . name ) ; if ( ! existingField ) { model . fields . push ( field ) ; } } export function removeFieldFromModel ( model , fieldName ) { model . fields = model . fields . filter ( field => field . name !== fieldName ) ; } export const getDirective = ( fieldOrModel ) => ( directiveName ) : CodeGenDirective | undefined => fieldOrModel . directives . find ( d => d . name === directiveName ) ;