Built motion from commit (unavailable).|2.2.0
[motion2.git] / server / components / import / cm / csv.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x8568=['query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','from','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','toString','into','cm_contacts','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','ListId\x20=\x20?','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','push','sequelize'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x8568,0x1d9));var _0x8856=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8568[_0x160c73];return _0xd9302;};'use strict';var BPromise=require(_0x8856('0x0'));var util=require(_0x8856('0x1'));var _=require(_0x8856('0x2'));var fs=require('fs');var squel=require(_0x8856('0x3'));var Papa=require(_0x8856('0x4'));var Redis=require('ioredis');var db=require(_0x8856('0x5'))['db'];var config=require(_0x8856('0x6'));var logger=require(_0x8856('0x7'))(_0x8856('0x8'));config[_0x8856('0x9')]=_[_0x8856('0xa')](config[_0x8856('0x9')],{'host':_0x8856('0xb'),'port':0x18eb});var socket=require(_0x8856('0xc'))(new Redis(config[_0x8856('0x9')]));require(_0x8856('0xd'))['register'](socket);try{if(!process[_0x8856('0xe')][0x2]||process[_0x8856('0xe')][0x2]===_0x8856('0xf')||process['argv'][0x2]==='null'){throw new Error(_0x8856('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x8856('0xe')][0x3]||process[_0x8856('0xe')][0x3]==='undefined'||process['argv'][0x3]===_0x8856('0x11')||!process[_0x8856('0xe')][0x4]||process[_0x8856('0xe')][0x4]==='undefined'||process[_0x8856('0xe')][0x4]==='null'){throw new Error(_0x8856('0x12'));}var FIELDS=_['zipObject'](process[_0x8856('0xe')][0x3]['split'](','),process[_0x8856('0xe')][0x4]['split'](','));if(!process[_0x8856('0xe')][0x5]||process[_0x8856('0xe')][0x5]===_0x8856('0xf')||process[_0x8856('0xe')][0x5]===_0x8856('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x8856('0xe')][0x6]!=='undefined'&&process[_0x8856('0xe')][0x6]!==_0x8856('0x11')?process[_0x8856('0xe')][0x6]:null;var DUPLICATES=process[_0x8856('0xe')][0x7]&&process[_0x8856('0xe')][0x7]!==_0x8856('0xf')&&process['argv'][0x7]!==_0x8856('0x11')?process[_0x8856('0xe')][0x7]:null;if(!process[_0x8856('0xe')][0x8]||process[_0x8856('0xe')][0x8]===_0x8856('0xf')||process[_0x8856('0xe')][0x8]==='null'){throw new Error(_0x8856('0x13'));}var SOCKET_TIMESTAMP=process[_0x8856('0xe')][0x8];}catch(_0x2c486f){logger[_0x8856('0x14')](_0x2c486f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x340712,_0x2ae308,_0x2c6848,_0x1e742d){var _0x4b75c2={'message':_0x2ae308};_0x4b75c2[_0x340712]=!![];if(_0x2c6848){_0x4b75c2[_0x8856('0x15')]=_0x2c6848;}if(_0x1e742d){_0x4b75c2[_0x8856('0x16')]=_0x1e742d;}return _0x4b75c2;}function isEmail(_0x5d4ab5){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x5d4ab5);}function checkRow(_0x32c381,_0x58967b,_0x5a25a1){return new BPromise(function(_0x5cd1c4,_0x592f22){if(_[_0x8856('0x17')](_0x32c381)){return _0x592f22(handleCheckRowError(_0x8856('0x14'),_0x8856('0x18'),null,_0x5a25a1));}if(_0x32c381[_0x8856('0x19')]&&_0x32c381[_0x8856('0x19')][_0x8856('0x1a')]){var _0x22c1fd=_[_0x8856('0x1b')](_0x32c381[_0x8856('0x19')],_0x8856('0x1c'))[_0x8856('0x1d')](';');return _0x592f22(handleCheckRowError('error',_0x22c1fd,null,_0x5a25a1));}var _0x229ba1={};for(var _0x3ebb29 in FIELDS){if(FIELDS[_0x8856('0x1e')](_0x3ebb29)&&FIELDS[_0x3ebb29]){_0x229ba1[_0x3ebb29]=_0x32c381[_0x8856('0x1f')][0x0][FIELDS[_0x3ebb29]]||_0x32c381['data'][0x0]['\ufeff'+FIELDS[_0x3ebb29]];}}if(!_0x229ba1[_0x8856('0x20')]){return _0x592f22(handleCheckRowError(_0x8856('0x14'),_0x8856('0x21'),null,_0x5a25a1));}if(!_0x229ba1['phone']){return _0x592f22(handleCheckRowError(_0x8856('0x14'),'phone\x20not\x20specified!',null,_0x5a25a1));}if(_0x229ba1[_0x8856('0x22')]){var _0xccca17=moment(_0x229ba1[_0x8856('0x22')],_0x8856('0x23'));if(!_0xccca17[_0x8856('0x24')]()){return _0x592f22(handleCheckRowError('error',_0x8856('0x25'),null,_0x5a25a1));}}if(_0x229ba1['email']){if(!isEmail(_0x229ba1[_0x8856('0x26')])){return _0x592f22(handleCheckRowError('error',_0x8856('0x27'),null,_0x5a25a1));}}_0x229ba1[_0x8856('0x28')]=LISTID;_0x229ba1['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8856('0x1a')]&&_0x58967b){var _0x5c1da0={};for(var _0x5a8a98=0x0,_0x3d3106=DUPLICATES[_0x8856('0x1a')];_0x5a8a98<_0x3d3106;_0x5a8a98+=0x1){_0x5c1da0[DUPLICATES[_0x5a8a98]]=_0x229ba1[DUPLICATES[_0x5a8a98]];}var _0x162818=_['find'](_0x58967b,_0x5c1da0);if(_0x162818){return _0x592f22(handleCheckRowError(_0x8856('0x29'),_0x8856('0x2a'),_0x162818,_0x5a25a1));}}return db[_0x8856('0x2b')][_0x8856('0x2c')](_0x229ba1,{'raw':!![],'hooks':![],'fields':_[_0x8856('0x2d')](_0x229ba1)})['then'](function(_0x14a6b6){if(DUPLICATES&&DUPLICATES[_0x8856('0x1a')]&&_0x58967b){_0x58967b['push'](_['pick'](_0x229ba1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x14a6b6['id'];return _0x5cd1c4();})[_0x8856('0x2e')](function(_0x30d13a){return _0x592f22(handleCheckRowError(_0x8856('0x14'),_0x8856('0x2f')+(_0x30d13a[_0x8856('0x1c')]||JSON[_0x8856('0x30')](_0x30d13a)),null,_0x5a25a1));});});}function checkHopper(){function _0x4b0b16(){return function(_0x214d7d){logger[_0x8856('0x14')]('cmContact',_0x8856('0x31'),util[_0x8856('0x32')](_0x214d7d,{'showHidden':![],'depth':null}));};}var _0x3c703d=function(_0x445d99,_0x280296){var _0x34cb90=squel[_0x8856('0x33')]()['into'](_0x8856('0x34'))[_0x8856('0x35')]([_0x8856('0x36'),_0x8856('0x37'),_0x8856('0x38'),_0x8856('0x28'),_0x280296,_0x8856('0x39'),_0x8856('0x3a')],squel[_0x8856('0x3b')]()['field']('phone','phone')[_0x8856('0x3c')](_0x8856('0x3d'),_0x8856('0x37'))['field']('id',_0x8856('0x38'))[_0x8856('0x3c')](LISTID['toString'](),_0x8856('0x28'))['field'](_0x445d99['id']['toString'](),_0x280296)[_0x8856('0x3c')](_0x8856('0x3d'),_0x8856('0x39'))['field'](_0x8856('0x3d'),'updatedAt')[_0x8856('0x3e')]('cm_contacts')[_0x8856('0x3f')](_0x8856('0x40'))[_0x8856('0x3f')]('ListId\x20=\x20?',LISTID['toString']())[_0x8856('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x8856('0x41'),squel[_0x8856('0x3b')]()['field'](_0x8856('0x36'))[_0x8856('0x3e')]('cm_hopper')[_0x8856('0x3f')](_0x280296+_0x8856('0x42'),_0x445d99['id']['toString']())))[_0x8856('0x43')]();return _0x34cb90;};var _0x439c02=function(_0x42bb20,_0x43f03c){var _0x408909=squel['insert']()[_0x8856('0x44')](_0x8856('0x34'))[_0x8856('0x35')]([_0x8856('0x36'),_0x8856('0x37'),_0x8856('0x38'),_0x8856('0x28'),_0x43f03c,_0x8856('0x39'),'updatedAt'],squel['select']()['field'](_0x8856('0x36'),_0x8856('0x36'))[_0x8856('0x3c')](_0x8856('0x3d'),_0x8856('0x37'))[_0x8856('0x3c')]('id',_0x8856('0x38'))['field'](LISTID[_0x8856('0x43')](),_0x8856('0x28'))[_0x8856('0x3c')](_0x42bb20['id'][_0x8856('0x43')](),_0x43f03c)[_0x8856('0x3c')]('NOW()',_0x8856('0x39'))['field'](_0x8856('0x3d'),_0x8856('0x3a'))[_0x8856('0x3e')](_0x8856('0x45'))[_0x8856('0x3f')](_0x8856('0x40'))[_0x8856('0x3f')]('ListId\x20=\x20?',LISTID[_0x8856('0x43')]())[_0x8856('0x3f')](_0x8856('0x46'),squel['str'](hopperContacts))[_0x8856('0x3f')](_0x8856('0x47'))['where'](_0x8856('0x41'),squel[_0x8856('0x3b')]()[_0x8856('0x3c')](_0x8856('0x48'))[_0x8856('0x3e')](_0x8856('0x49'))[_0x8856('0x3f')](_0x43f03c+_0x8856('0x42'),_0x42bb20['id'][_0x8856('0x43')]()))[_0x8856('0x3f')](_0x8856('0x41'),squel['select']()[_0x8856('0x3c')](_0x8856('0x36'))[_0x8856('0x3e')](_0x8856('0x34'))[_0x8856('0x3f')](_0x43f03c+_0x8856('0x42'),_0x42bb20['id'][_0x8856('0x43')]())))[_0x8856('0x43')]();return _0x408909;};function _0xcfa908(_0x147f3e,_0x1e802d){var _0x44071e=squel[_0x8856('0x33')]()['into'](_0x8856('0x34'))[_0x8856('0x35')](['phone',_0x8856('0x37'),'ContactId',_0x8856('0x28'),_0x1e802d,_0x8856('0x39'),_0x8856('0x3a')],squel[_0x8856('0x3b')]()[_0x8856('0x3c')](_0x8856('0x36'),_0x8856('0x36'))[_0x8856('0x3c')](_0x8856('0x3d'),_0x8856('0x37'))[_0x8856('0x3c')]('id','ContactId')[_0x8856('0x3c')](LISTID['toString'](),_0x8856('0x28'))['field'](_0x147f3e['id'][_0x8856('0x43')](),_0x1e802d)[_0x8856('0x3c')](_0x8856('0x3d'),_0x8856('0x39'))[_0x8856('0x3c')]('NOW()',_0x8856('0x3a'))[_0x8856('0x3e')](_0x8856('0x45'))[_0x8856('0x3f')](_0x8856('0x40'))['where'](_0x8856('0x4a'),LISTID[_0x8856('0x43')]())[_0x8856('0x3f')](_0x8856('0x46'),squel['str'](hopperContacts))[_0x8856('0x3f')](_0x8856('0x47')))[_0x8856('0x43')]();return _0x44071e;}function _0x51c945(_0x10feba,_0x353dd3){var _0x488d79=squel[_0x8856('0x33')]()['into']('cm_hopper_black')['fromQuery']([_0x8856('0x36'),_0x8856('0x38'),_0x8856('0x28'),_0x353dd3,_0x8856('0x39'),_0x8856('0x3a')],squel[_0x8856('0x3b')]()[_0x8856('0x3c')](_0x8856('0x36'),_0x8856('0x36'))[_0x8856('0x3c')]('id',_0x8856('0x38'))[_0x8856('0x3c')](LISTID['toString'](),_0x8856('0x28'))[_0x8856('0x3c')](_0x10feba['id']['toString'](),_0x353dd3)['field'](_0x8856('0x3d'),_0x8856('0x39'))[_0x8856('0x3c')](_0x8856('0x3d'),_0x8856('0x3a'))[_0x8856('0x3e')](_0x8856('0x45'))[_0x8856('0x3f')](_0x8856('0x40'))[_0x8856('0x3f')](_0x8856('0x4a'),LISTID['toString']())['where'](_0x8856('0x46'),squel[_0x8856('0x4b')](hopperContacts))['where'](_0x8856('0x47')))[_0x8856('0x43')]();return _0x488d79;}return db[_0x8856('0x4c')][_0x8856('0x4d')]({'where':{'type':_0x8856('0x4e')},'attributes':['id',_0x8856('0x4f')],'include':[{'model':db[_0x8856('0x50')],'as':_0x8856('0x51'),'where':{'id':LISTID}}]})[_0x8856('0x52')](function(_0x169732){var _0x1fa736=[];if(_0x169732){var _0x201f23;for(var _0x4b9d32=0x0,_0x568005;_0x4b9d32<_0x169732[_0x8856('0x1a')];_0x4b9d32+=0x1){_0x568005=_0x169732[_0x4b9d32][_0x8856('0x53')]({'plain':!![]});switch(_0x568005['dialCheckDuplicateType']){case _0x8856('0x54'):_0x1fa736[_0x8856('0x55')](db[_0x8856('0x56')][_0x8856('0x57')](_0x439c02(_0x568005,_0x8856('0x58')))['then'](function(){})['catch'](_0x4b0b16()));break;case _0x8856('0x59'):_0x1fa736[_0x8856('0x55')](db[_0x8856('0x56')]['query'](_0x3c703d(_0x568005,'VoiceQueueId'))[_0x8856('0x52')](function(){})['catch'](_0x4b0b16()));break;default:_0x1fa736[_0x8856('0x55')](db['sequelize']['query'](_0xcfa908(_0x568005,'VoiceQueueId'))[_0x8856('0x52')](function(){})[_0x8856('0x2e')](_0x4b0b16()));}}}return _0x1fa736;})[_0x8856('0x5a')]()['then'](function(){return db[_0x8856('0x4c')][_0x8856('0x4d')]({'where':{'type':_0x8856('0x4e')},'attributes':['id'],'include':[{'model':db[_0x8856('0x50')],'as':_0x8856('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x434c54){var _0x5a1abe=[];if(_0x434c54){var _0x260222;for(var _0x1792ff=0x0,_0x1dbbae;_0x1792ff<_0x434c54[_0x8856('0x1a')];_0x1792ff+=0x1){_0x1dbbae=_0x434c54[_0x1792ff][_0x8856('0x53')]({'plain':!![]});_0x5a1abe[_0x8856('0x55')](db[_0x8856('0x56')][_0x8856('0x57')](_0x51c945(_0x1dbbae,_0x8856('0x58')))[_0x8856('0x52')](function(){})[_0x8856('0x2e')](_0x4b0b16()));}}return _0x5a1abe;})['all']();})['then'](function(){return db[_0x8856('0x5c')][_0x8856('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8856('0x50')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x32f8d8){var _0xa2a2d9=[];if(_0x32f8d8){for(var _0x3e26ae=0x0,_0x162f87;_0x3e26ae<_0x32f8d8['length'];_0x3e26ae+=0x1){_0x162f87=_0x32f8d8[_0x3e26ae][_0x8856('0x53')]({'plain':!![]});switch(_0x162f87['dialCheckDuplicateType']){case _0x8856('0x54'):_0xa2a2d9[_0x8856('0x55')](db[_0x8856('0x56')][_0x8856('0x57')](_0x439c02(_0x162f87,_0x8856('0x5d')))[_0x8856('0x52')](function(){})[_0x8856('0x2e')](_0x4b0b16()));break;case _0x8856('0x59'):_0xa2a2d9[_0x8856('0x55')](db[_0x8856('0x56')][_0x8856('0x57')](_0x3c703d(_0x162f87,_0x8856('0x5d')))[_0x8856('0x52')](function(){})['catch'](_0x4b0b16()));break;default:_0xa2a2d9[_0x8856('0x55')](db[_0x8856('0x56')][_0x8856('0x57')](_0xcfa908(_0x162f87,_0x8856('0x5d')))[_0x8856('0x52')](function(){})['catch'](_0x4b0b16()));}}}return _0xa2a2d9;})[_0x8856('0x5a')]();})['then'](function(){return db[_0x8856('0x5c')][_0x8856('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x8856('0x50')],'as':_0x8856('0x5b'),'where':{'id':LISTID}}]})[_0x8856('0x52')](function(_0x29e501){var _0x46bff0=[];if(_0x29e501){for(var _0x2261f8=0x0,_0x495db0;_0x2261f8<_0x29e501['length'];_0x2261f8+=0x1){_0x495db0=_0x29e501[_0x2261f8]['get']({'plain':!![]});_0x46bff0['push'](db[_0x8856('0x56')][_0x8856('0x57')](_0x51c945(_0x495db0,_0x8856('0x5d')))[_0x8856('0x52')](function(){})[_0x8856('0x2e')](_0x4b0b16()));}}return _0x46bff0;})[_0x8856('0x5a')]();})[_0x8856('0x2e')](function(_0x4010e3){logger[_0x8856('0x14')](_0x8856('0x5e'),_0x8856('0x5f'),_0x4010e3[_0x8856('0x1c')]);});}var processPromises=function(_0x495493){return BPromise[_0x8856('0x5a')](promises)[_0x8856('0x52')](function(_0x176c93){})[_0x8856('0x2e')](function(_0x333a85){logger[_0x8856('0x14')](_0x8856('0x60'),JSON[_0x8856('0x30')](_0x333a85));})[_0x8856('0x61')](function(){socket[_0x8856('0x62')](_0x8856('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x495493){return _0x495493['resume']();}});};var endCsv=function(){return BPromise[_0x8856('0x64')]()[_0x8856('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0x8856('0x52')](function(){socket[_0x8856('0x62')](_0x8856('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8856('0x65')](FILEPATH);}catch(_0x208a5c){logger[_0x8856('0x14')](_0x8856('0x66'),JSON[_0x8856('0x30')](_0x208a5c));}finally{process['exit'](0x0);}});};process['on'](_0x8856('0x67'),function(){logger['info'](_0x8856('0x68'));endCsv();});function main(){return BPromise[_0x8856('0x64')]()[_0x8856('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8856('0x69')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8856('0x52')](function(_0x1e0b52){var _0x5c7184=fs[_0x8856('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8856('0x6b')](_0x5c7184,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5655f3,_0x275ab7){total+=0x1;var _0x1062a4=total;promises[_0x8856('0x55')](checkRow(_0x5655f3,_0x1e0b52,_0x1062a4)[_0x8856('0x52')](function(){success+=0x1;})[_0x8856('0x2e')](function(_0x13de21){if(_0x13de21['error']){errors+=0x1;delete _0x13de21[_0x8856('0x14')];}else if(_0x13de21[_0x8856('0x29')]){duplicates+=0x1;delete _0x13de21[_0x8856('0x29')];}rows[_0x8856('0x55')](_0x13de21);}));if(total%0xc8===0x0){_0x275ab7[_0x8856('0x6c')]();return processPromises(_0x275ab7);}},'complete':function(){return processPromises()[_0x8856('0x52')](function(){logger[_0x8856('0x6d')](_0x8856('0x6e'));endCsv();});},'error':function(_0x4e868e,_0x1d9109){logger[_0x8856('0x6d')](_0x8856('0x6f'),JSON[_0x8856('0x30')](_0x4e868e));endCsv();}});})[_0x8856('0x2e')](function(_0x1345dc){logger[_0x8856('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x8856('0x30')](_0x1345dc));});}main();