Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / components / import / cm / csv.js
index 45549a3..be79485 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6f4=['CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','select','scheduledAt','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','sequelize','VoiceQueueId','push','query','all','BlackLists','Campaign','get','always','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email\x20format\x20is\x20not\x20valid!','ListId'];(function(_0x2b0188,_0x2e6f26){var _0x30489c=function(_0x18c912){while(--_0x18c912){_0x2b0188['push'](_0x2b0188['shift']());}};_0x30489c(++_0x2e6f26);}(_0xd6f4,0x121));var _0x4d6f=function(_0x44f2dd,_0x349975){_0x44f2dd=_0x44f2dd-0x0;var _0x4f9ee0=_0xd6f4[_0x44f2dd];return _0x4f9ee0;};'use strict';var BPromise=require(_0x4d6f('0x0'));var util=require('util');var _=require(_0x4d6f('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x4d6f('0x2'));var Redis=require('ioredis');var db=require(_0x4d6f('0x3'))['db'];var config=require(_0x4d6f('0x4'));var logger=require(_0x4d6f('0x5'))(_0x4d6f('0x6'));config[_0x4d6f('0x7')]=_[_0x4d6f('0x8')](config['redis'],{'host':_0x4d6f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d6f('0x7')]));require(_0x4d6f('0xa'))[_0x4d6f('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x4d6f('0xc')][0x2]===_0x4d6f('0xd')||process[_0x4d6f('0xc')][0x2]==='null'){throw new Error(_0x4d6f('0xe'));}var FILEPATH=process[_0x4d6f('0xc')][0x2];if(!process[_0x4d6f('0xc')][0x3]||process['argv'][0x3]===_0x4d6f('0xd')||process[_0x4d6f('0xc')][0x3]===_0x4d6f('0xf')||!process['argv'][0x4]||process['argv'][0x4]===_0x4d6f('0xd')||process[_0x4d6f('0xc')][0x4]===_0x4d6f('0xf')){throw new Error(_0x4d6f('0x10'));}var FIELDS=_[_0x4d6f('0x11')](process[_0x4d6f('0xc')][0x3][_0x4d6f('0x12')](','),process[_0x4d6f('0xc')][0x4][_0x4d6f('0x12')](','));if(!process['argv'][0x5]||process[_0x4d6f('0xc')][0x5]===_0x4d6f('0xd')||process[_0x4d6f('0xc')][0x5]==='null'){throw new Error(_0x4d6f('0x13'));}var LISTID=process[_0x4d6f('0xc')][0x5];var COMPANYID=process[_0x4d6f('0xc')][0x6]&&process[_0x4d6f('0xc')][0x6]!==_0x4d6f('0xd')&&process['argv'][0x6]!==_0x4d6f('0xf')?process[_0x4d6f('0xc')][0x6]:null;var DUPLICATES=process[_0x4d6f('0xc')][0x7]&&process['argv'][0x7]!==_0x4d6f('0xd')&&process[_0x4d6f('0xc')][0x7]!==_0x4d6f('0xf')?process[_0x4d6f('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0x4d6f('0xc')][0x8]===_0x4d6f('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x4d6f('0xc')][0x8];}catch(_0x358a90){logger[_0x4d6f('0x14')](_0x358a90);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(_0x387c7c,_0x4a1b52,_0x24da58,_0xa61c4f){var _0x413cfd={'message':_0x4a1b52};_0x413cfd[_0x387c7c]=!![];if(_0x24da58){_0x413cfd[_0x4d6f('0x15')]=_0x24da58;}if(_0xa61c4f){_0x413cfd[_0x4d6f('0x16')]=_0xa61c4f;}return _0x413cfd;}function isEmail(_0x4da1dd){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'](_0x4da1dd);}function checkRow(_0x4f318a,_0x514a4f,_0x4adcbc){return new BPromise(function(_0x2222f1,_0x488980){if(_['isNil'](_0x4f318a)){return _0x488980(handleCheckRowError('error',_0x4d6f('0x17'),null,_0x4adcbc));}if(_0x4f318a['errors']&&_0x4f318a[_0x4d6f('0x18')][_0x4d6f('0x19')]){var _0x405c88=_[_0x4d6f('0x1a')](_0x4f318a[_0x4d6f('0x18')],_0x4d6f('0x1b'))['join'](';');return _0x488980(handleCheckRowError(_0x4d6f('0x14'),_0x405c88,null,_0x4adcbc));}var _0x2822ac={};for(var _0x15cf9b in FIELDS){if(FIELDS[_0x4d6f('0x1c')](_0x15cf9b)&&FIELDS[_0x15cf9b]){_0x2822ac[_0x15cf9b]=_0x4f318a['data'][0x0][FIELDS[_0x15cf9b]]||_0x4f318a[_0x4d6f('0x1d')][0x0]['\ufeff'+FIELDS[_0x15cf9b]];}}if(!_0x2822ac['firstName']){return _0x488980(handleCheckRowError(_0x4d6f('0x14'),_0x4d6f('0x1e'),null,_0x4adcbc));}if(!_0x2822ac[_0x4d6f('0x1f')]){return _0x488980(handleCheckRowError(_0x4d6f('0x14'),_0x4d6f('0x20'),null,_0x4adcbc));}if(_0x2822ac[_0x4d6f('0x21')]){var _0x1ba382=moment(_0x2822ac['birthDate'],_0x4d6f('0x22'));if(!_0x1ba382[_0x4d6f('0x23')]()){return _0x488980(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4adcbc));}}if(_0x2822ac['email']){if(!isEmail(_0x2822ac['email'])){return _0x488980(handleCheckRowError(_0x4d6f('0x14'),_0x4d6f('0x24'),null,_0x4adcbc));}}_0x2822ac[_0x4d6f('0x25')]=LISTID;_0x2822ac[_0x4d6f('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4d6f('0x19')]&&_0x514a4f){var _0xf235ba={};for(var _0x58419c=0x0,_0x16272a=DUPLICATES['length'];_0x58419c<_0x16272a;_0x58419c+=0x1){_0xf235ba[DUPLICATES[_0x58419c]]=_0x2822ac[DUPLICATES[_0x58419c]];}var _0x31ccba=_[_0x4d6f('0x27')](_0x514a4f,_0xf235ba);if(_0x31ccba){return _0x488980(handleCheckRowError(_0x4d6f('0x28'),_0x4d6f('0x29'),_0x31ccba,_0x4adcbc));}}return db[_0x4d6f('0x2a')][_0x4d6f('0x2b')](_0x2822ac,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2822ac)})[_0x4d6f('0x2c')](function(_0x431499){if(DUPLICATES&&DUPLICATES[_0x4d6f('0x19')]&&_0x514a4f){_0x514a4f['push'](_[_0x4d6f('0x2d')](_0x2822ac,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x431499['id'];return _0x2222f1();})[_0x4d6f('0x2e')](function(_0xeccbd6){return _0x488980(handleCheckRowError(_0x4d6f('0x14'),_0x4d6f('0x2f')+(_0xeccbd6['message']||JSON['stringify'](_0xeccbd6)),null,_0x4adcbc));});});}function checkHopper(){function _0x3d3fdf(){return function(_0xb5ada2){logger[_0x4d6f('0x14')](_0x4d6f('0x30'),_0x4d6f('0x31'),util[_0x4d6f('0x32')](_0xb5ada2,{'showHidden':![],'depth':null}));};}var _0x253b5f=function(_0xe6e001,_0x45dba2){var _0x5a9811=squel[_0x4d6f('0x33')]()[_0x4d6f('0x34')](_0x4d6f('0x35'))[_0x4d6f('0x36')]([_0x4d6f('0x1f'),'scheduledAt',_0x4d6f('0x37'),_0x4d6f('0x25'),_0x45dba2,_0x4d6f('0x38'),_0x4d6f('0x39')],squel['select']()[_0x4d6f('0x3a')](_0x4d6f('0x1f'),_0x4d6f('0x1f'))[_0x4d6f('0x3a')](_0x4d6f('0x3b'),'scheduledAt')[_0x4d6f('0x3a')]('id','ContactId')['field'](LISTID[_0x4d6f('0x3c')](),_0x4d6f('0x25'))[_0x4d6f('0x3a')](_0xe6e001['id'][_0x4d6f('0x3c')](),_0x45dba2)['field'](_0x4d6f('0x3b'),_0x4d6f('0x38'))[_0x4d6f('0x3a')](_0x4d6f('0x3b'),'updatedAt')[_0x4d6f('0x3d')](_0x4d6f('0x3e'))[_0x4d6f('0x3f')](_0x4d6f('0x40'))[_0x4d6f('0x3f')](_0x4d6f('0x41'),LISTID[_0x4d6f('0x3c')]())[_0x4d6f('0x3f')](_0x4d6f('0x42'))[_0x4d6f('0x3f')](_0x4d6f('0x43'),squel['select']()[_0x4d6f('0x3a')](_0x4d6f('0x1f'))[_0x4d6f('0x3d')](_0x4d6f('0x35'))[_0x4d6f('0x3f')](_0x45dba2+_0x4d6f('0x44'),_0xe6e001['id']['toString']())))[_0x4d6f('0x3c')]();return _0x5a9811;};var _0x253488=function(_0x73d635,_0x2fed89){var _0x224afb=squel[_0x4d6f('0x33')]()[_0x4d6f('0x34')]('cm_hopper')['fromQuery']([_0x4d6f('0x1f'),'scheduledAt','ContactId',_0x4d6f('0x25'),_0x2fed89,_0x4d6f('0x38'),'updatedAt'],squel[_0x4d6f('0x45')]()['field'](_0x4d6f('0x1f'),_0x4d6f('0x1f'))['field']('NOW()',_0x4d6f('0x46'))[_0x4d6f('0x3a')]('id',_0x4d6f('0x37'))[_0x4d6f('0x3a')](LISTID[_0x4d6f('0x3c')](),_0x4d6f('0x25'))['field'](_0x73d635['id'][_0x4d6f('0x3c')](),_0x2fed89)[_0x4d6f('0x3a')](_0x4d6f('0x3b'),_0x4d6f('0x38'))[_0x4d6f('0x3a')](_0x4d6f('0x3b'),'updatedAt')['from'](_0x4d6f('0x3e'))[_0x4d6f('0x3f')](_0x4d6f('0x40'))[_0x4d6f('0x3f')]('ListId\x20=\x20?',LISTID[_0x4d6f('0x3c')]())[_0x4d6f('0x3f')](_0x4d6f('0x47'),squel[_0x4d6f('0x48')](hopperContacts))[_0x4d6f('0x3f')](_0x4d6f('0x42'))['where'](_0x4d6f('0x43'),squel[_0x4d6f('0x45')]()[_0x4d6f('0x3a')]('calleridnum')[_0x4d6f('0x3d')](_0x4d6f('0x49'))[_0x4d6f('0x3f')](_0x2fed89+'\x20=\x20?',_0x73d635['id'][_0x4d6f('0x3c')]()))['where'](_0x4d6f('0x43'),squel[_0x4d6f('0x45')]()[_0x4d6f('0x3a')]('phone')['from']('cm_hopper')[_0x4d6f('0x3f')](_0x2fed89+'\x20=\x20?',_0x73d635['id'][_0x4d6f('0x3c')]())))[_0x4d6f('0x3c')]();return _0x224afb;};function _0x5d99ea(_0x3fcf8e,_0x4d0511){var _0x1fc440=squel['insert']()['into'](_0x4d6f('0x35'))[_0x4d6f('0x36')](['phone','scheduledAt','ContactId',_0x4d6f('0x25'),_0x4d0511,_0x4d6f('0x38'),'updatedAt'],squel[_0x4d6f('0x45')]()[_0x4d6f('0x3a')](_0x4d6f('0x1f'),_0x4d6f('0x1f'))['field']('NOW()','scheduledAt')[_0x4d6f('0x3a')]('id',_0x4d6f('0x37'))[_0x4d6f('0x3a')](LISTID[_0x4d6f('0x3c')](),_0x4d6f('0x25'))[_0x4d6f('0x3a')](_0x3fcf8e['id'][_0x4d6f('0x3c')](),_0x4d0511)[_0x4d6f('0x3a')](_0x4d6f('0x3b'),_0x4d6f('0x38'))[_0x4d6f('0x3a')](_0x4d6f('0x3b'),_0x4d6f('0x39'))[_0x4d6f('0x3d')](_0x4d6f('0x3e'))['where'](_0x4d6f('0x40'))[_0x4d6f('0x3f')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x4d6f('0x47'),squel['str'](hopperContacts))[_0x4d6f('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x4d6f('0x3c')]();return _0x1fc440;}function _0x2ed23f(_0x30bdc4,_0x4a4a61){var _0x1e9e69=squel[_0x4d6f('0x33')]()['into'](_0x4d6f('0x4a'))['fromQuery']([_0x4d6f('0x1f'),_0x4d6f('0x37'),_0x4d6f('0x25'),_0x4a4a61,_0x4d6f('0x38'),'updatedAt'],squel[_0x4d6f('0x45')]()[_0x4d6f('0x3a')](_0x4d6f('0x1f'),_0x4d6f('0x1f'))['field']('id','ContactId')[_0x4d6f('0x3a')](LISTID[_0x4d6f('0x3c')](),_0x4d6f('0x25'))['field'](_0x30bdc4['id']['toString'](),_0x4a4a61)['field']('NOW()',_0x4d6f('0x38'))['field'](_0x4d6f('0x3b'),_0x4d6f('0x39'))[_0x4d6f('0x3d')]('cm_contacts')[_0x4d6f('0x3f')](_0x4d6f('0x40'))[_0x4d6f('0x3f')]('ListId\x20=\x20?',LISTID[_0x4d6f('0x3c')]())['where'](_0x4d6f('0x47'),squel[_0x4d6f('0x48')](hopperContacts))[_0x4d6f('0x3f')](_0x4d6f('0x42')))['toString']();return _0x1e9e69;}return db[_0x4d6f('0x4b')][_0x4d6f('0x4c')]({'where':{'type':_0x4d6f('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x4d6f('0x4e')],'as':_0x4d6f('0x4f'),'where':{'id':LISTID}}]})[_0x4d6f('0x2c')](function(_0x2e94ce){var _0x5197a1=[];if(_0x2e94ce){var _0x4cbeae;for(var _0x3854b2=0x0,_0x4e84fd;_0x3854b2<_0x2e94ce[_0x4d6f('0x19')];_0x3854b2+=0x1){_0x4e84fd=_0x2e94ce[_0x3854b2]['get']({'plain':!![]});switch(_0x4e84fd[_0x4d6f('0x50')]){case'always':_0x5197a1['push'](db[_0x4d6f('0x51')]['query'](_0x253488(_0x4e84fd,_0x4d6f('0x52')))['then'](function(){})[_0x4d6f('0x2e')](_0x3d3fdf()));break;case'onlyIfOpen':_0x5197a1[_0x4d6f('0x53')](db['sequelize'][_0x4d6f('0x54')](_0x253b5f(_0x4e84fd,'VoiceQueueId'))[_0x4d6f('0x2c')](function(){})[_0x4d6f('0x2e')](_0x3d3fdf()));break;default:_0x5197a1[_0x4d6f('0x53')](db[_0x4d6f('0x51')][_0x4d6f('0x54')](_0x5d99ea(_0x4e84fd,_0x4d6f('0x52')))[_0x4d6f('0x2c')](function(){})[_0x4d6f('0x2e')](_0x3d3fdf()));}}}return _0x5197a1;})[_0x4d6f('0x55')]()[_0x4d6f('0x2c')](function(){return db[_0x4d6f('0x4b')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x4d6f('0x4e')],'as':_0x4d6f('0x56'),'where':{'id':LISTID}}]})[_0x4d6f('0x2c')](function(_0x2e3af8){var _0x3340ab=[];if(_0x2e3af8){var _0x47b3de;for(var _0x31a1aa=0x0,_0x1e2259;_0x31a1aa<_0x2e3af8[_0x4d6f('0x19')];_0x31a1aa+=0x1){_0x1e2259=_0x2e3af8[_0x31a1aa]['get']({'plain':!![]});_0x3340ab[_0x4d6f('0x53')](db[_0x4d6f('0x51')][_0x4d6f('0x54')](_0x2ed23f(_0x1e2259,_0x4d6f('0x52')))[_0x4d6f('0x2c')](function(){})[_0x4d6f('0x2e')](_0x3d3fdf()));}}return _0x3340ab;})[_0x4d6f('0x55')]();})[_0x4d6f('0x2c')](function(){return db[_0x4d6f('0x57')]['findAll']({'attributes':['id',_0x4d6f('0x50')],'include':[{'model':db['CmList'],'as':_0x4d6f('0x4f'),'where':{'id':LISTID}}]})[_0x4d6f('0x2c')](function(_0x49993e){var _0x3a11c4=[];if(_0x49993e){for(var _0x5ca272=0x0,_0x33b079;_0x5ca272<_0x49993e[_0x4d6f('0x19')];_0x5ca272+=0x1){_0x33b079=_0x49993e[_0x5ca272][_0x4d6f('0x58')]({'plain':!![]});switch(_0x33b079[_0x4d6f('0x50')]){case _0x4d6f('0x59'):_0x3a11c4[_0x4d6f('0x53')](db[_0x4d6f('0x51')]['query'](_0x253488(_0x33b079,_0x4d6f('0x5a')))[_0x4d6f('0x2c')](function(){})['catch'](_0x3d3fdf()));break;case _0x4d6f('0x5b'):_0x3a11c4[_0x4d6f('0x53')](db['sequelize'][_0x4d6f('0x54')](_0x253b5f(_0x33b079,_0x4d6f('0x5a')))[_0x4d6f('0x2c')](function(){})[_0x4d6f('0x2e')](_0x3d3fdf()));break;default:_0x3a11c4[_0x4d6f('0x53')](db['sequelize'][_0x4d6f('0x54')](_0x5d99ea(_0x33b079,_0x4d6f('0x5a')))['then'](function(){})[_0x4d6f('0x2e')](_0x3d3fdf()));}}}return _0x3a11c4;})[_0x4d6f('0x55')]();})[_0x4d6f('0x2c')](function(){return db[_0x4d6f('0x57')][_0x4d6f('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x4d6f('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x4d6f('0x2c')](function(_0x4365b6){var _0x344e52=[];if(_0x4365b6){for(var _0x17dd70=0x0,_0xcb329c;_0x17dd70<_0x4365b6['length'];_0x17dd70+=0x1){_0xcb329c=_0x4365b6[_0x17dd70][_0x4d6f('0x58')]({'plain':!![]});_0x344e52[_0x4d6f('0x53')](db[_0x4d6f('0x51')][_0x4d6f('0x54')](_0x2ed23f(_0xcb329c,_0x4d6f('0x5a')))[_0x4d6f('0x2c')](function(){})['catch'](_0x3d3fdf()));}}return _0x344e52;})[_0x4d6f('0x55')]();})[_0x4d6f('0x2e')](function(_0x206dcc){logger[_0x4d6f('0x14')]('cmContact,\x20%s,\x20%s',_0x4d6f('0x5c'),_0x206dcc[_0x4d6f('0x1b')]);});}var processPromises=function(_0x9ec4af){return BPromise[_0x4d6f('0x55')](promises)[_0x4d6f('0x2c')](function(_0x51e468){})[_0x4d6f('0x2e')](function(_0x6b2a98){logger[_0x4d6f('0x14')](_0x4d6f('0x5d'),JSON[_0x4d6f('0x5e')](_0x6b2a98));})[_0x4d6f('0x5f')](function(){socket[_0x4d6f('0x60')](_0x4d6f('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x9ec4af){return _0x9ec4af['resume']();}});};var endCsv=function(){return BPromise[_0x4d6f('0x62')]()[_0x4d6f('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x4d6f('0x2c')](function(){socket[_0x4d6f('0x60')](_0x4d6f('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4d6f('0x63')](FILEPATH);}catch(_0x475b26){logger[_0x4d6f('0x14')](_0x4d6f('0x64'),JSON[_0x4d6f('0x5e')](_0x475b26));}finally{process[_0x4d6f('0x65')](0x0);}});};process['on']('SIGINT',function(){logger[_0x4d6f('0x66')](_0x4d6f('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x4d6f('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4d6f('0x12')](',');return db['CmContact'][_0x4d6f('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4d6f('0x2c')](function(_0x41000f){var _0x24d620=fs[_0x4d6f('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x4d6f('0x69')](_0x24d620,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b1d74,_0x6de32d){total+=0x1;var _0x6336b9=total;promises['push'](checkRow(_0x5b1d74,_0x41000f,_0x6336b9)[_0x4d6f('0x2c')](function(){success+=0x1;})[_0x4d6f('0x2e')](function(_0x318c5b){if(_0x318c5b['error']){errors+=0x1;delete _0x318c5b[_0x4d6f('0x14')];}else if(_0x318c5b[_0x4d6f('0x28')]){duplicates+=0x1;delete _0x318c5b[_0x4d6f('0x28')];}rows['push'](_0x318c5b);}));if(total%0xc8===0x0){_0x6de32d['pause']();return processPromises(_0x6de32d);}},'complete':function(){return processPromises()['then'](function(){logger[_0x4d6f('0x66')](_0x4d6f('0x6a'));endCsv();});},'error':function(_0x326b8c,_0x57f56c){logger['info'](_0x4d6f('0x6b'),JSON[_0x4d6f('0x5e')](_0x326b8c));endCsv();}});})[_0x4d6f('0x2e')](function(_0x453f46){logger[_0x4d6f('0x14')](_0x4d6f('0x6c'),JSON[_0x4d6f('0x5e')](_0x453f46));});}main();
\ No newline at end of file
+var _0xbaca=['updatedAt','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','\x20=\x20?','insert','cm_hopper_black','VoiceQueue','outbound','CmList','dialCheckDuplicateType','always','query','VoiceQueueId','catch','onlyIfOpen','sequelize','all','findAll','BlackLists','Lists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','localhost','redis','../../../api/cmContact/cmContact.socket','undefined','argv','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','errors','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','duplicate','Duplicate\x20Contact','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','into','cm_hopper','fromQuery','scheduledAt','ContactId'];(function(_0x1c8943,_0x3b52e9){var _0x1e3862=function(_0x5b6f2a){while(--_0x5b6f2a){_0x1c8943['push'](_0x1c8943['shift']());}};_0x1e3862(++_0x3b52e9);}(_0xbaca,0x15d));var _0xabac=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaca[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xabac('0x0'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xabac('0x1'));var Redis=require(_0xabac('0x2'));var db=require(_0xabac('0x3'))['db'];var config=require(_0xabac('0x4'));var logger=require('../../../config/logger')(_0xabac('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xabac('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabac('0x7')]));require(_0xabac('0x8'))['register'](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xabac('0x9')||process[_0xabac('0xa')][0x2]===_0xabac('0xb')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xabac('0xa')][0x2];if(!process[_0xabac('0xa')][0x3]||process[_0xabac('0xa')][0x3]===_0xabac('0x9')||process[_0xabac('0xa')][0x3]===_0xabac('0xb')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process[_0xabac('0xa')][0x4]===_0xabac('0xb')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xabac('0xc')](process[_0xabac('0xa')][0x3][_0xabac('0xd')](','),process['argv'][0x4][_0xabac('0xd')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xabac('0x9')||process[_0xabac('0xa')][0x5]===_0xabac('0xb')){throw new Error(_0xabac('0xe'));}var LISTID=process[_0xabac('0xa')][0x5];var COMPANYID=process[_0xabac('0xa')][0x6]&&process[_0xabac('0xa')][0x6]!==_0xabac('0x9')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xabac('0xa')][0x7]&&process[_0xabac('0xa')][0x7]!=='undefined'&&process[_0xabac('0xa')][0x7]!=='null'?process[_0xabac('0xa')][0x7]:null;if(!process[_0xabac('0xa')][0x8]||process[_0xabac('0xa')][0x8]==='undefined'||process[_0xabac('0xa')][0x8]===_0xabac('0xb')){throw new Error(_0xabac('0xf'));}var SOCKET_TIMESTAMP=process[_0xabac('0xa')][0x8];}catch(_0x4bdcd1){logger[_0xabac('0x10')](_0x4bdcd1);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(_0x347248,_0x33016b,_0x3babec,_0x327692){var _0x5ecfa0={'message':_0x33016b};_0x5ecfa0[_0x347248]=!![];if(_0x3babec){_0x5ecfa0[_0xabac('0x11')]=_0x3babec;}if(_0x327692){_0x5ecfa0['index']=_0x327692;}return _0x5ecfa0;}function isEmail(_0x3399fe){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'](_0x3399fe);}function checkRow(_0x1c6580,_0x461917,_0x6f26f7){return new BPromise(function(_0x5581b6,_0xf2082b){if(_[_0xabac('0x12')](_0x1c6580)){return _0xf2082b(handleCheckRowError('error',_0xabac('0x13'),null,_0x6f26f7));}if(_0x1c6580['errors']&&_0x1c6580['errors'][_0xabac('0x14')]){var _0xb051eb=_['map'](_0x1c6580[_0xabac('0x15')],'message')['join'](';');return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xb051eb,null,_0x6f26f7));}var _0x2d6cfa={};for(var _0x32b1a3 in FIELDS){if(FIELDS[_0xabac('0x16')](_0x32b1a3)&&FIELDS[_0x32b1a3]){_0x2d6cfa[_0x32b1a3]=_0x1c6580[_0xabac('0x17')][0x0][FIELDS[_0x32b1a3]]||_0x1c6580['data'][0x0]['\ufeff'+FIELDS[_0x32b1a3]];}}if(!_0x2d6cfa[_0xabac('0x18')]){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xabac('0x19'),null,_0x6f26f7));}if(!_0x2d6cfa[_0xabac('0x1a')]){return _0xf2082b(handleCheckRowError('error',_0xabac('0x1b'),null,_0x6f26f7));}if(_0x2d6cfa['birthDate']){var _0x286baa=moment(_0x2d6cfa[_0xabac('0x1c')],_0xabac('0x1d'));if(!_0x286baa['isValid']()){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xabac('0x1e'),null,_0x6f26f7));}}if(_0x2d6cfa['email']){if(!isEmail(_0x2d6cfa[_0xabac('0x1f')])){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x6f26f7));}}_0x2d6cfa[_0xabac('0x20')]=LISTID;_0x2d6cfa[_0xabac('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xabac('0x14')]&&_0x461917){var _0x4cc1b1={};for(var _0xd490cc=0x0,_0x1f8b10=DUPLICATES[_0xabac('0x14')];_0xd490cc<_0x1f8b10;_0xd490cc+=0x1){_0x4cc1b1[DUPLICATES[_0xd490cc]]=_0x2d6cfa[DUPLICATES[_0xd490cc]];}var _0x4e35dd=_['find'](_0x461917,_0x4cc1b1);if(_0x4e35dd){return _0xf2082b(handleCheckRowError(_0xabac('0x22'),_0xabac('0x23'),_0x4e35dd,_0x6f26f7));}}return db['CmContact']['create'](_0x2d6cfa,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2d6cfa)})[_0xabac('0x24')](function(_0x9da1f){if(DUPLICATES&&DUPLICATES[_0xabac('0x14')]&&_0x461917){_0x461917[_0xabac('0x25')](_['pick'](_0x2d6cfa,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x9da1f['id'];return _0x5581b6();})['catch'](function(_0x5a0267){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xabac('0x26')+(_0x5a0267['message']||JSON[_0xabac('0x27')](_0x5a0267)),null,_0x6f26f7));});});}function checkHopper(){function _0x224d09(){return function(_0x2db1a9){logger[_0xabac('0x10')](_0xabac('0x28'),_0xabac('0x29'),util['inspect'](_0x2db1a9,{'showHidden':![],'depth':null}));};}var _0xe7c73e=function(_0x352201,_0x130210){var _0x11d3a8=squel['insert']()[_0xabac('0x2a')](_0xabac('0x2b'))[_0xabac('0x2c')]([_0xabac('0x1a'),_0xabac('0x2d'),_0xabac('0x2e'),_0xabac('0x20'),_0x130210,'createdAt',_0xabac('0x2f')],squel['select']()[_0xabac('0x30')](_0xabac('0x1a'),_0xabac('0x1a'))[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x2d'))[_0xabac('0x30')]('id',_0xabac('0x2e'))['field'](LISTID[_0xabac('0x32')](),'ListId')['field'](_0x352201['id'][_0xabac('0x32')](),_0x130210)[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x33'))['field'](_0xabac('0x31'),_0xabac('0x2f'))[_0xabac('0x34')](_0xabac('0x35'))[_0xabac('0x36')](_0xabac('0x37'))[_0xabac('0x36')](_0xabac('0x38'),LISTID[_0xabac('0x32')]())[_0xabac('0x36')](_0xabac('0x39'))[_0xabac('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0xabac('0x3a')]()['field'](_0xabac('0x1a'))[_0xabac('0x34')](_0xabac('0x2b'))[_0xabac('0x36')](_0x130210+'\x20=\x20?',_0x352201['id']['toString']())))[_0xabac('0x32')]();return _0x11d3a8;};var _0x20c657=function(_0x5ed830,_0xa49722){var _0xc88ab8=squel['insert']()[_0xabac('0x2a')](_0xabac('0x2b'))['fromQuery']([_0xabac('0x1a'),_0xabac('0x2d'),_0xabac('0x2e'),_0xabac('0x20'),_0xa49722,_0xabac('0x33'),_0xabac('0x2f')],squel[_0xabac('0x3a')]()[_0xabac('0x30')]('phone',_0xabac('0x1a'))[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x2d'))[_0xabac('0x30')]('id',_0xabac('0x2e'))[_0xabac('0x30')](LISTID[_0xabac('0x32')](),_0xabac('0x20'))['field'](_0x5ed830['id'][_0xabac('0x32')](),_0xa49722)[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x33'))['field'](_0xabac('0x31'),_0xabac('0x2f'))[_0xabac('0x34')](_0xabac('0x35'))[_0xabac('0x36')](_0xabac('0x37'))[_0xabac('0x36')]('ListId\x20=\x20?',LISTID[_0xabac('0x32')]())[_0xabac('0x36')](_0xabac('0x3b'),squel[_0xabac('0x3c')](hopperContacts))[_0xabac('0x36')](_0xabac('0x39'))[_0xabac('0x36')](_0xabac('0x3d'),squel['select']()['field'](_0xabac('0x3e'))[_0xabac('0x34')]('cm_hopper_final')[_0xabac('0x36')](_0xa49722+_0xabac('0x3f'),_0x5ed830['id'][_0xabac('0x32')]()))['where'](_0xabac('0x3d'),squel['select']()[_0xabac('0x30')](_0xabac('0x1a'))['from']('cm_hopper')[_0xabac('0x36')](_0xa49722+'\x20=\x20?',_0x5ed830['id']['toString']())))[_0xabac('0x32')]();return _0xc88ab8;};function _0x32a598(_0x779ec9,_0x19fdd4){var _0x5c1afd=squel[_0xabac('0x40')]()[_0xabac('0x2a')](_0xabac('0x2b'))[_0xabac('0x2c')]([_0xabac('0x1a'),_0xabac('0x2d'),_0xabac('0x2e'),'ListId',_0x19fdd4,_0xabac('0x33'),_0xabac('0x2f')],squel['select']()['field'](_0xabac('0x1a'),_0xabac('0x1a'))[_0xabac('0x30')](_0xabac('0x31'),'scheduledAt')[_0xabac('0x30')]('id',_0xabac('0x2e'))[_0xabac('0x30')](LISTID['toString'](),_0xabac('0x20'))['field'](_0x779ec9['id'][_0xabac('0x32')](),_0x19fdd4)[_0xabac('0x30')]('NOW()',_0xabac('0x33'))[_0xabac('0x30')](_0xabac('0x31'),'updatedAt')['from'](_0xabac('0x35'))[_0xabac('0x36')](_0xabac('0x37'))[_0xabac('0x36')](_0xabac('0x38'),LISTID['toString']())[_0xabac('0x36')]('id\x20IN\x20?',squel[_0xabac('0x3c')](hopperContacts))[_0xabac('0x36')](_0xabac('0x39')))[_0xabac('0x32')]();return _0x5c1afd;}function _0x1030cb(_0x28fa6e,_0xa63259){var _0x3a6ef7=squel[_0xabac('0x40')]()[_0xabac('0x2a')](_0xabac('0x41'))[_0xabac('0x2c')]([_0xabac('0x1a'),'ContactId',_0xabac('0x20'),_0xa63259,_0xabac('0x33'),'updatedAt'],squel[_0xabac('0x3a')]()[_0xabac('0x30')](_0xabac('0x1a'),_0xabac('0x1a'))[_0xabac('0x30')]('id',_0xabac('0x2e'))[_0xabac('0x30')](LISTID['toString'](),'ListId')[_0xabac('0x30')](_0x28fa6e['id'][_0xabac('0x32')](),_0xa63259)[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x33'))[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x2f'))[_0xabac('0x34')](_0xabac('0x35'))[_0xabac('0x36')]('deletedAt\x20IS\x20NULL')[_0xabac('0x36')](_0xabac('0x38'),LISTID[_0xabac('0x32')]())[_0xabac('0x36')](_0xabac('0x3b'),squel[_0xabac('0x3c')](hopperContacts))[_0xabac('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0xabac('0x32')]();return _0x3a6ef7;}return db[_0xabac('0x42')]['findAll']({'where':{'type':_0xabac('0x43')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xabac('0x44')],'as':'Lists','where':{'id':LISTID}}]})[_0xabac('0x24')](function(_0x235c78){var _0x2e532a=[];if(_0x235c78){var _0xf7d810;for(var _0x5875ac=0x0,_0x277459;_0x5875ac<_0x235c78[_0xabac('0x14')];_0x5875ac+=0x1){_0x277459=_0x235c78[_0x5875ac]['get']({'plain':!![]});switch(_0x277459[_0xabac('0x45')]){case _0xabac('0x46'):_0x2e532a[_0xabac('0x25')](db['sequelize'][_0xabac('0x47')](_0x20c657(_0x277459,_0xabac('0x48')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));break;case _0xabac('0x4a'):_0x2e532a[_0xabac('0x25')](db[_0xabac('0x4b')]['query'](_0xe7c73e(_0x277459,_0xabac('0x48')))[_0xabac('0x24')](function(){})['catch'](_0x224d09()));break;default:_0x2e532a[_0xabac('0x25')](db[_0xabac('0x4b')][_0xabac('0x47')](_0x32a598(_0x277459,_0xabac('0x48')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));}}}return _0x2e532a;})[_0xabac('0x4c')]()['then'](function(){return db[_0xabac('0x42')][_0xabac('0x4d')]({'where':{'type':_0xabac('0x43')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xabac('0x4e'),'where':{'id':LISTID}}]})[_0xabac('0x24')](function(_0x14a12b){var _0x309b4c=[];if(_0x14a12b){var _0x121b3e;for(var _0x1fe8f2=0x0,_0x10f91a;_0x1fe8f2<_0x14a12b[_0xabac('0x14')];_0x1fe8f2+=0x1){_0x10f91a=_0x14a12b[_0x1fe8f2]['get']({'plain':!![]});_0x309b4c['push'](db[_0xabac('0x4b')][_0xabac('0x47')](_0x1030cb(_0x10f91a,_0xabac('0x48')))[_0xabac('0x24')](function(){})['catch'](_0x224d09()));}}return _0x309b4c;})[_0xabac('0x4c')]();})['then'](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xabac('0x44')],'as':_0xabac('0x4f'),'where':{'id':LISTID}}]})[_0xabac('0x24')](function(_0x283790){var _0x371d79=[];if(_0x283790){for(var _0x431799=0x0,_0x5ea8ae;_0x431799<_0x283790['length'];_0x431799+=0x1){_0x5ea8ae=_0x283790[_0x431799][_0xabac('0x50')]({'plain':!![]});switch(_0x5ea8ae[_0xabac('0x45')]){case _0xabac('0x46'):_0x371d79[_0xabac('0x25')](db['sequelize'][_0xabac('0x47')](_0x20c657(_0x5ea8ae,_0xabac('0x51')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));break;case _0xabac('0x4a'):_0x371d79[_0xabac('0x25')](db[_0xabac('0x4b')]['query'](_0xe7c73e(_0x5ea8ae,'CampaignId'))['then'](function(){})['catch'](_0x224d09()));break;default:_0x371d79[_0xabac('0x25')](db['sequelize']['query'](_0x32a598(_0x5ea8ae,_0xabac('0x51')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));}}}return _0x371d79;})[_0xabac('0x4c')]();})[_0xabac('0x24')](function(){return db['Campaign'][_0xabac('0x4d')]({'attributes':['id'],'include':[{'model':db[_0xabac('0x44')],'as':_0xabac('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x1996ab){var _0x59d311=[];if(_0x1996ab){for(var _0x34527b=0x0,_0x99ee6a;_0x34527b<_0x1996ab[_0xabac('0x14')];_0x34527b+=0x1){_0x99ee6a=_0x1996ab[_0x34527b]['get']({'plain':!![]});_0x59d311[_0xabac('0x25')](db[_0xabac('0x4b')]['query'](_0x1030cb(_0x99ee6a,_0xabac('0x51')))['then'](function(){})[_0xabac('0x49')](_0x224d09()));}}return _0x59d311;})[_0xabac('0x4c')]();})['catch'](function(_0xe1f569){logger[_0xabac('0x10')](_0xabac('0x52'),_0xabac('0x53'),_0xe1f569[_0xabac('0x54')]);});}var processPromises=function(_0x19413b){return BPromise['all'](promises)[_0xabac('0x24')](function(_0x35cf97){})['catch'](function(_0x1e5a42){logger[_0xabac('0x10')]('Error\x20processing\x20rows\x20block:',JSON[_0xabac('0x27')](_0x1e5a42));})[_0xabac('0x55')](function(){socket['emit'](_0xabac('0x56')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x19413b){return _0x19413b[_0xabac('0x57')]();}});};var endCsv=function(){return BPromise[_0xabac('0x58')]()[_0xabac('0x24')](function(){if(hopperContacts){return checkHopper();}})[_0xabac('0x24')](function(){socket[_0xabac('0x59')](_0xabac('0x56')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xabac('0x5a')](FILEPATH);}catch(_0x5ec270){logger[_0xabac('0x10')](_0xabac('0x5b'),JSON[_0xabac('0x27')](_0x5ec270));}finally{process['exit'](0x0);}});};process['on'](_0xabac('0x5c'),function(){logger[_0xabac('0x5d')](_0xabac('0x5e'));endCsv();});function main(){return BPromise[_0xabac('0x58')]()[_0xabac('0x24')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xabac('0xd')](',');return db[_0xabac('0x5f')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x98e4ac){var _0x2cbd46=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2cbd46,{'header':!![],'skipEmptyLines':!![],'step':function(_0xb02eca,_0x432956){total+=0x1;var _0x16fa57=total;promises[_0xabac('0x25')](checkRow(_0xb02eca,_0x98e4ac,_0x16fa57)[_0xabac('0x24')](function(){success+=0x1;})[_0xabac('0x49')](function(_0x31b29a){if(_0x31b29a['error']){errors+=0x1;delete _0x31b29a['error'];}else if(_0x31b29a['duplicate']){duplicates+=0x1;delete _0x31b29a[_0xabac('0x22')];}rows[_0xabac('0x25')](_0x31b29a);}));if(total%0xc8===0x0){_0x432956[_0xabac('0x60')]();return processPromises(_0x432956);}},'complete':function(){return processPromises()[_0xabac('0x24')](function(){logger[_0xabac('0x5d')](_0xabac('0x61'));endCsv();});},'error':function(_0x59d23f,_0x27ab1b){logger[_0xabac('0x5d')](_0xabac('0x62'),JSON[_0xabac('0x27')](_0x59d23f));endCsv();}});})[_0xabac('0x49')](function(_0x8301b3){logger[_0xabac('0x10')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xabac('0x27')](_0x8301b3));});}main();
\ No newline at end of file