16ff46230eeb70418d8ef24c8861d6fb0a988a16
[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 _0xadfe=['lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','then','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','select','field','toString','NOW()','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','findAll','dialCheckDuplicateType','Lists','get','always','push','sequelize','query','VoiceQueueId','catch','VoiceQueue','outbound','CmList','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird'];(function(_0x31caaa,_0x2925c3){var _0x207b17=function(_0x112688){while(--_0x112688){_0x31caaa['push'](_0x31caaa['shift']());}};_0x207b17(++_0x2925c3);}(_0xadfe,0xd7));var _0xeadf=function(_0x5d54bc,_0x185f85){_0x5d54bc=_0x5d54bc-0x0;var _0x34cf6f=_0xadfe[_0x5d54bc];return _0x34cf6f;};'use strict';var BPromise=require(_0xeadf('0x0'));var util=require('util');var _=require(_0xeadf('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xeadf('0x2'));var Redis=require(_0xeadf('0x3'));var db=require(_0xeadf('0x4'))['db'];var config=require(_0xeadf('0x5'));var logger=require('../../../config/logger')(_0xeadf('0x6'));config[_0xeadf('0x7')]=_['defaults'](config[_0xeadf('0x7')],{'host':_0xeadf('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeadf('0x9'))[_0xeadf('0xa')](socket);try{if(!process[_0xeadf('0xb')][0x2]||process[_0xeadf('0xb')][0x2]==='undefined'||process[_0xeadf('0xb')][0x2]===_0xeadf('0xc')){throw new Error(_0xeadf('0xd'));}var FILEPATH=process[_0xeadf('0xb')][0x2];if(!process[_0xeadf('0xb')][0x3]||process[_0xeadf('0xb')][0x3]===_0xeadf('0xe')||process['argv'][0x3]===_0xeadf('0xc')||!process[_0xeadf('0xb')][0x4]||process['argv'][0x4]===_0xeadf('0xe')||process[_0xeadf('0xb')][0x4]===_0xeadf('0xc')){throw new Error(_0xeadf('0xf'));}var FIELDS=_[_0xeadf('0x10')](process[_0xeadf('0xb')][0x3][_0xeadf('0x11')](','),process[_0xeadf('0xb')][0x4][_0xeadf('0x11')](','));if(!process['argv'][0x5]||process[_0xeadf('0xb')][0x5]===_0xeadf('0xe')||process[_0xeadf('0xb')][0x5]===_0xeadf('0xc')){throw new Error(_0xeadf('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xeadf('0xb')][0x6]&&process['argv'][0x6]!==_0xeadf('0xe')&&process['argv'][0x6]!=='null'?process[_0xeadf('0xb')][0x6]:null;var DUPLICATES=process[_0xeadf('0xb')][0x7]&&process[_0xeadf('0xb')][0x7]!==_0xeadf('0xe')&&process[_0xeadf('0xb')][0x7]!==_0xeadf('0xc')?process[_0xeadf('0xb')][0x7]:null;if(!process[_0xeadf('0xb')][0x8]||process['argv'][0x8]===_0xeadf('0xe')||process[_0xeadf('0xb')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xeadf('0xb')][0x8];}catch(_0x4568eb){logger['error'](_0x4568eb);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(_0x268d15,_0x14cf84,_0x3d26aa,_0x31af44){var _0x5e8da4={'message':_0x14cf84};_0x5e8da4[_0x268d15]=!![];if(_0x3d26aa){_0x5e8da4['contact']=_0x3d26aa;}if(_0x31af44){_0x5e8da4['index']=_0x31af44;}return _0x5e8da4;}function isEmail(_0x231f88){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))*$/[_0xeadf('0x13')](_0x231f88);}function checkRow(_0x25e21b,_0x406a65,_0xd9f35a){return new BPromise(function(_0x27ffa7,_0x8eee86){if(_[_0xeadf('0x14')](_0x25e21b)){return _0x8eee86(handleCheckRowError(_0xeadf('0x15'),_0xeadf('0x16'),null,_0xd9f35a));}if(_0x25e21b['errors']&&_0x25e21b[_0xeadf('0x17')]['length']){var _0x202d45=_[_0xeadf('0x18')](_0x25e21b[_0xeadf('0x17')],_0xeadf('0x19'))[_0xeadf('0x1a')](';');return _0x8eee86(handleCheckRowError(_0xeadf('0x15'),_0x202d45,null,_0xd9f35a));}var _0x208350={};for(var _0x2561ae in FIELDS){if(FIELDS[_0xeadf('0x1b')](_0x2561ae)&&FIELDS[_0x2561ae]){_0x208350[_0x2561ae]=_0x25e21b[_0xeadf('0x1c')][0x0][FIELDS[_0x2561ae]]||_0x25e21b['data'][0x0]['\ufeff'+FIELDS[_0x2561ae]];}}if(!_0x208350[_0xeadf('0x1d')]){return _0x8eee86(handleCheckRowError(_0xeadf('0x15'),_0xeadf('0x1e'),null,_0xd9f35a));}if(!_0x208350[_0xeadf('0x1f')]){return _0x8eee86(handleCheckRowError(_0xeadf('0x15'),'phone\x20not\x20specified!',null,_0xd9f35a));}if(_0x208350['birthDate']){var _0x41d2a7=moment(_0x208350[_0xeadf('0x20')],_0xeadf('0x21'));if(!_0x41d2a7[_0xeadf('0x22')]()){return _0x8eee86(handleCheckRowError(_0xeadf('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0xd9f35a));}}if(_0x208350['email']){if(!isEmail(_0x208350[_0xeadf('0x23')])){return _0x8eee86(handleCheckRowError(_0xeadf('0x15'),_0xeadf('0x24'),null,_0xd9f35a));}}_0x208350[_0xeadf('0x25')]=LISTID;_0x208350[_0xeadf('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xeadf('0x27')]&&_0x406a65){var _0x4b08b7={};for(var _0x4ced0a=0x0,_0x3bcd8a=DUPLICATES[_0xeadf('0x27')];_0x4ced0a<_0x3bcd8a;_0x4ced0a+=0x1){_0x4b08b7[DUPLICATES[_0x4ced0a]]=_0x208350[DUPLICATES[_0x4ced0a]];}var _0x1d3957=_[_0xeadf('0x28')](_0x406a65,_0x4b08b7);if(_0x1d3957){return _0x8eee86(handleCheckRowError(_0xeadf('0x29'),_0xeadf('0x2a'),_0x1d3957,_0xd9f35a));}}return db[_0xeadf('0x2b')][_0xeadf('0x2c')](_0x208350,{'raw':!![],'hooks':![],'fields':_['keys'](_0x208350)})[_0xeadf('0x2d')](function(_0x512383){if(DUPLICATES&&DUPLICATES[_0xeadf('0x27')]&&_0x406a65){_0x406a65['push'](_['pick'](_0x208350,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x512383['id'];return _0x27ffa7();})['catch'](function(_0x5f2767){return _0x8eee86(handleCheckRowError(_0xeadf('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x5f2767[_0xeadf('0x19')]||JSON[_0xeadf('0x2e')](_0x5f2767)),null,_0xd9f35a));});});}function checkHopper(){function _0x14af75(){return function(_0x2ba6a1){logger[_0xeadf('0x15')](_0xeadf('0x2f'),_0xeadf('0x30'),util[_0xeadf('0x31')](_0x2ba6a1,{'showHidden':![],'depth':null}));};}var _0x81b703=function(_0x5bbbbc,_0xb545b9){var _0x5df75a=squel[_0xeadf('0x32')]()[_0xeadf('0x33')](_0xeadf('0x34'))['fromQuery']([_0xeadf('0x1f'),_0xeadf('0x35'),_0xeadf('0x36'),_0xeadf('0x25'),_0xb545b9,_0xeadf('0x37'),'updatedAt'],squel[_0xeadf('0x38')]()[_0xeadf('0x39')](_0xeadf('0x1f'),'phone')[_0xeadf('0x39')]('NOW()',_0xeadf('0x35'))[_0xeadf('0x39')]('id','ContactId')['field'](LISTID[_0xeadf('0x3a')](),_0xeadf('0x25'))[_0xeadf('0x39')](_0x5bbbbc['id'][_0xeadf('0x3a')](),_0xb545b9)['field'](_0xeadf('0x3b'),_0xeadf('0x37'))['field'](_0xeadf('0x3b'),_0xeadf('0x3c'))['from'](_0xeadf('0x3d'))[_0xeadf('0x3e')](_0xeadf('0x3f'))['where'](_0xeadf('0x40'),LISTID['toString']())['where'](_0xeadf('0x41'))[_0xeadf('0x3e')](_0xeadf('0x42'),squel[_0xeadf('0x38')]()[_0xeadf('0x39')](_0xeadf('0x1f'))[_0xeadf('0x43')](_0xeadf('0x34'))[_0xeadf('0x3e')](_0xb545b9+'\x20=\x20?',_0x5bbbbc['id'][_0xeadf('0x3a')]())))['toString']();return _0x5df75a;};var _0x2fd046=function(_0x394edb,_0x2fc452){var _0x4edb77=squel['insert']()['into']('cm_hopper')[_0xeadf('0x44')]([_0xeadf('0x1f'),_0xeadf('0x35'),_0xeadf('0x36'),'ListId',_0x2fc452,_0xeadf('0x37'),'updatedAt'],squel[_0xeadf('0x38')]()[_0xeadf('0x39')]('phone',_0xeadf('0x1f'))[_0xeadf('0x39')](_0xeadf('0x3b'),_0xeadf('0x35'))[_0xeadf('0x39')]('id',_0xeadf('0x36'))['field'](LISTID['toString'](),'ListId')[_0xeadf('0x39')](_0x394edb['id']['toString'](),_0x2fc452)[_0xeadf('0x39')](_0xeadf('0x3b'),_0xeadf('0x37'))[_0xeadf('0x39')]('NOW()',_0xeadf('0x3c'))[_0xeadf('0x43')](_0xeadf('0x3d'))[_0xeadf('0x3e')](_0xeadf('0x3f'))[_0xeadf('0x3e')](_0xeadf('0x40'),LISTID[_0xeadf('0x3a')]())[_0xeadf('0x3e')](_0xeadf('0x45'),squel[_0xeadf('0x46')](hopperContacts))[_0xeadf('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xeadf('0x3e')](_0xeadf('0x42'),squel[_0xeadf('0x38')]()['field'](_0xeadf('0x47'))[_0xeadf('0x43')](_0xeadf('0x48'))[_0xeadf('0x3e')](_0x2fc452+'\x20=\x20?',_0x394edb['id'][_0xeadf('0x3a')]()))[_0xeadf('0x3e')](_0xeadf('0x42'),squel[_0xeadf('0x38')]()['field'](_0xeadf('0x1f'))[_0xeadf('0x43')](_0xeadf('0x34'))['where'](_0x2fc452+_0xeadf('0x49'),_0x394edb['id'][_0xeadf('0x3a')]())))[_0xeadf('0x3a')]();return _0x4edb77;};function _0x1fa17b(_0x4129a0,_0x43a33e){var _0x267f35=squel[_0xeadf('0x32')]()['into']('cm_hopper')[_0xeadf('0x44')]([_0xeadf('0x1f'),_0xeadf('0x35'),_0xeadf('0x36'),_0xeadf('0x25'),_0x43a33e,_0xeadf('0x37'),_0xeadf('0x3c')],squel[_0xeadf('0x38')]()['field']('phone',_0xeadf('0x1f'))[_0xeadf('0x39')](_0xeadf('0x3b'),_0xeadf('0x35'))[_0xeadf('0x39')]('id','ContactId')[_0xeadf('0x39')](LISTID['toString'](),'ListId')[_0xeadf('0x39')](_0x4129a0['id'][_0xeadf('0x3a')](),_0x43a33e)[_0xeadf('0x39')]('NOW()',_0xeadf('0x37'))['field']('NOW()','updatedAt')['from'](_0xeadf('0x3d'))[_0xeadf('0x3e')]('deletedAt\x20IS\x20NULL')[_0xeadf('0x3e')]('ListId\x20=\x20?',LISTID[_0xeadf('0x3a')]())[_0xeadf('0x3e')](_0xeadf('0x45'),squel[_0xeadf('0x46')](hopperContacts))[_0xeadf('0x3e')](_0xeadf('0x41')))[_0xeadf('0x3a')]();return _0x267f35;}function _0x6be8fc(_0x1f55c1,_0x3aeab8){var _0x7f08b7=squel[_0xeadf('0x32')]()[_0xeadf('0x33')]('cm_hopper_black')[_0xeadf('0x44')]([_0xeadf('0x1f'),_0xeadf('0x36'),'ListId',_0x3aeab8,_0xeadf('0x37'),_0xeadf('0x3c')],squel[_0xeadf('0x38')]()['field']('phone',_0xeadf('0x1f'))[_0xeadf('0x39')]('id',_0xeadf('0x36'))[_0xeadf('0x39')](LISTID[_0xeadf('0x3a')](),_0xeadf('0x25'))[_0xeadf('0x39')](_0x1f55c1['id'][_0xeadf('0x3a')](),_0x3aeab8)['field'](_0xeadf('0x3b'),_0xeadf('0x37'))['field'](_0xeadf('0x3b'),_0xeadf('0x3c'))[_0xeadf('0x43')](_0xeadf('0x3d'))[_0xeadf('0x3e')](_0xeadf('0x3f'))[_0xeadf('0x3e')](_0xeadf('0x40'),LISTID[_0xeadf('0x3a')]())[_0xeadf('0x3e')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xeadf('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x7f08b7;}return db['VoiceQueue'][_0xeadf('0x4a')]({'where':{'type':'outbound'},'attributes':['id',_0xeadf('0x4b')],'include':[{'model':db['CmList'],'as':_0xeadf('0x4c'),'where':{'id':LISTID}}]})['then'](function(_0x1576bc){var _0x2d184a=[];if(_0x1576bc){var _0x3596c8;for(var _0x3b67b4=0x0,_0x1bb059;_0x3b67b4<_0x1576bc[_0xeadf('0x27')];_0x3b67b4+=0x1){_0x1bb059=_0x1576bc[_0x3b67b4][_0xeadf('0x4d')]({'plain':!![]});switch(_0x1bb059[_0xeadf('0x4b')]){case _0xeadf('0x4e'):_0x2d184a[_0xeadf('0x4f')](db[_0xeadf('0x50')][_0xeadf('0x51')](_0x2fd046(_0x1bb059,_0xeadf('0x52')))[_0xeadf('0x2d')](function(){})[_0xeadf('0x53')](_0x14af75()));break;case'onlyIfOpen':_0x2d184a['push'](db['sequelize'][_0xeadf('0x51')](_0x81b703(_0x1bb059,_0xeadf('0x52')))['then'](function(){})[_0xeadf('0x53')](_0x14af75()));break;default:_0x2d184a[_0xeadf('0x4f')](db[_0xeadf('0x50')][_0xeadf('0x51')](_0x1fa17b(_0x1bb059,_0xeadf('0x52')))[_0xeadf('0x2d')](function(){})[_0xeadf('0x53')](_0x14af75()));}}}return _0x2d184a;})['all']()[_0xeadf('0x2d')](function(){return db[_0xeadf('0x54')][_0xeadf('0x4a')]({'where':{'type':_0xeadf('0x55')},'attributes':['id'],'include':[{'model':db[_0xeadf('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xeadf('0x2d')](function(_0x325e56){var _0x11169c=[];if(_0x325e56){var _0x15da1a;for(var _0x299957=0x0,_0x41e238;_0x299957<_0x325e56['length'];_0x299957+=0x1){_0x41e238=_0x325e56[_0x299957]['get']({'plain':!![]});_0x11169c[_0xeadf('0x4f')](db[_0xeadf('0x50')]['query'](_0x6be8fc(_0x41e238,'VoiceQueueId'))[_0xeadf('0x2d')](function(){})[_0xeadf('0x53')](_0x14af75()));}}return _0x11169c;})[_0xeadf('0x57')]();})[_0xeadf('0x2d')](function(){return db[_0xeadf('0x58')]['findAll']({'attributes':['id',_0xeadf('0x4b')],'include':[{'model':db[_0xeadf('0x56')],'as':_0xeadf('0x4c'),'where':{'id':LISTID}}]})['then'](function(_0xe792ca){var _0x23a770=[];if(_0xe792ca){for(var _0x5ec88c=0x0,_0x5c98c2;_0x5ec88c<_0xe792ca['length'];_0x5ec88c+=0x1){_0x5c98c2=_0xe792ca[_0x5ec88c][_0xeadf('0x4d')]({'plain':!![]});switch(_0x5c98c2[_0xeadf('0x4b')]){case'always':_0x23a770[_0xeadf('0x4f')](db[_0xeadf('0x50')][_0xeadf('0x51')](_0x2fd046(_0x5c98c2,_0xeadf('0x59')))[_0xeadf('0x2d')](function(){})[_0xeadf('0x53')](_0x14af75()));break;case'onlyIfOpen':_0x23a770[_0xeadf('0x4f')](db[_0xeadf('0x50')][_0xeadf('0x51')](_0x81b703(_0x5c98c2,_0xeadf('0x59')))[_0xeadf('0x2d')](function(){})['catch'](_0x14af75()));break;default:_0x23a770['push'](db['sequelize'][_0xeadf('0x51')](_0x1fa17b(_0x5c98c2,'CampaignId'))['then'](function(){})[_0xeadf('0x53')](_0x14af75()));}}}return _0x23a770;})[_0xeadf('0x57')]();})[_0xeadf('0x2d')](function(){return db[_0xeadf('0x58')][_0xeadf('0x4a')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xeadf('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x2beb0f){var _0x21741f=[];if(_0x2beb0f){for(var _0x1cf4d8=0x0,_0x43f2fc;_0x1cf4d8<_0x2beb0f['length'];_0x1cf4d8+=0x1){_0x43f2fc=_0x2beb0f[_0x1cf4d8][_0xeadf('0x4d')]({'plain':!![]});_0x21741f[_0xeadf('0x4f')](db[_0xeadf('0x50')][_0xeadf('0x51')](_0x6be8fc(_0x43f2fc,'CampaignId'))[_0xeadf('0x2d')](function(){})[_0xeadf('0x53')](_0x14af75()));}}return _0x21741f;})[_0xeadf('0x57')]();})['catch'](function(_0x41e9d2){logger[_0xeadf('0x15')](_0xeadf('0x5b'),_0xeadf('0x5c'),_0x41e9d2[_0xeadf('0x19')]);});}var processPromises=function(_0x1d2983){return BPromise[_0xeadf('0x57')](promises)['then'](function(_0x2731da){})[_0xeadf('0x53')](function(_0x2fb55d){logger['error'](_0xeadf('0x5d'),JSON[_0xeadf('0x2e')](_0x2fb55d));})[_0xeadf('0x5e')](function(){socket[_0xeadf('0x5f')](_0xeadf('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1d2983){return _0x1d2983['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0xeadf('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xeadf('0x2d')](function(){socket[_0xeadf('0x5f')](_0xeadf('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xeadf('0x61')](FILEPATH);}catch(_0x505db3){logger[_0xeadf('0x15')](_0xeadf('0x62'),JSON[_0xeadf('0x2e')](_0x505db3));}finally{process[_0xeadf('0x63')](0x0);}});};process['on'](_0xeadf('0x64'),function(){logger[_0xeadf('0x65')](_0xeadf('0x66'));endCsv();});function main(){return BPromise['resolve']()[_0xeadf('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xeadf('0x11')](',');return db[_0xeadf('0x2b')][_0xeadf('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xeadf('0x2d')](function(_0x36b9ef){var _0x59f955=fs[_0xeadf('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xeadf('0x68')](_0x59f955,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a6930,_0x42b2fa){total+=0x1;var _0x486c2b=total;promises['push'](checkRow(_0x1a6930,_0x36b9ef,_0x486c2b)['then'](function(){success+=0x1;})[_0xeadf('0x53')](function(_0x4786d7){if(_0x4786d7['error']){errors+=0x1;delete _0x4786d7[_0xeadf('0x15')];}else if(_0x4786d7[_0xeadf('0x29')]){duplicates+=0x1;delete _0x4786d7[_0xeadf('0x29')];}rows[_0xeadf('0x4f')](_0x4786d7);}));if(total%0xc8===0x0){_0x42b2fa[_0xeadf('0x69')]();return processPromises(_0x42b2fa);}},'complete':function(){return processPromises()[_0xeadf('0x2d')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x272535,_0x4ef7b0){logger[_0xeadf('0x65')](_0xeadf('0x6a'),JSON[_0xeadf('0x2e')](_0x272535));endCsv();}});})[_0xeadf('0x53')](function(_0x1b0399){logger[_0xeadf('0x15')](_0xeadf('0x6b'),JSON['stringify'](_0x1b0399));});}main();