File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed 
components/gocanvas/actions/create-or-update-reference-data Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import  gocanvas  from  "../../gocanvas.app.mjs" ; 
2- import  *  as  csvParse  from  "csv-parse" ; 
2+ import  {  parse  }  from  "csv-parse/sync" ; 
3+ import  {  ConfigurationError  }  from  "@pipedream/platform" ; 
34
45export  default  { 
56  key : "gocanvas-create-or-update-reference-data" , 
@@ -27,11 +28,15 @@ export default {
2728  } , 
2829  methods : { 
2930    csvToXml ( data )  { 
30-       const  records  =  csvParse . parse ( data ,  { 
31+       const  records  =  parse ( data ,  { 
3132        columns : true , 
3233        trim : true , 
3334      } ) ; 
3435
36+       if  ( ! records ?. length )  { 
37+         throw  new  ConfigurationError ( "No data items found to create/update. Please enter column names and at least 1 row of data." ) ; 
38+       } 
39+ 
3540      // Extract columns 
3641      const  columns  =  Object . keys ( records [ 0 ] ) ; 
3742      let  result  =  "<Columns>" ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments