Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / cmHopper / cmHopper.rpc.js
index c6e294a..832a806 100644 (file)
@@ -1 +1 @@
-const a139_0x34b7=['destroy','stringify','Agent','../../config/logger','MoveContactManagedDialer','LOCK','YYYY-MM-DD\x20HH:mm:ss','catch','COUNT','keys','describe','Contact','order','ShowCmHopper','update','raw','UpdateCmHopper','include','format','body','push','CountReScheduled','CmContact','error','create','voicePause','findAll','model','options','`scheduledat`\x20>=\x20','length','limit','includes','User','sequelize','lodash','DestroyCmHopper','GetCmHopper','../../mysqldb','info','\x22%s\x22','transaction','CreateCmHopper','attributes','GetContactDialer','CmHopperFinal','map','GetContactRecallMe','then','message','UPDATE','GetCmHopperPreview','where','CmHopper','debug','all'];(function(_0x469cd9,_0x34b7e3){const _0x47f98b=function(_0x2bb87d){while(--_0x2bb87d){_0x469cd9['push'](_0x469cd9['shift']());}};_0x47f98b(++_0x34b7e3);}(a139_0x34b7,0x192));const a139_0x47f9=function(_0x469cd9,_0x34b7e3){_0x469cd9=_0x469cd9-0x0;let _0x47f98b=a139_0x34b7[_0x469cd9];return _0x47f98b;};const _0x1816d5=a139_0x47f9;'use strict';const _=require(_0x1816d5('0x19')),util=require('util'),moment=require('moment'),db=require(_0x1816d5('0x1c'))['db'],logger=require(_0x1816d5('0x31'))('rpc'),{literal,fn}=require(_0x1816d5('0x18'));exports[_0x1816d5('0x1b')]=function(_0x2bb87d){const _0x238db6=this;return new Promise(function(_0x3665be,_0x3a9fa2){const _0x603bdf=a139_0x47f9;return db[_0x603bdf('0x2b')][_0x603bdf('0x10')]({'raw':_0x2bb87d[_0x603bdf('0x12')]?_0x2bb87d[_0x603bdf('0x12')][_0x603bdf('0x5')]===undefined?!![]:![]:!![],'where':_0x2bb87d[_0x603bdf('0x12')]?_0x2bb87d[_0x603bdf('0x12')][_0x603bdf('0x2a')]||null:null,'attributes':_0x2bb87d[_0x603bdf('0x12')]?_0x2bb87d[_0x603bdf('0x12')][_0x603bdf('0x21')]||null:null,'limit':_0x2bb87d['options']?_0x2bb87d[_0x603bdf('0x12')][_0x603bdf('0x15')]||null:null,'include':_0x2bb87d['options']?_0x2bb87d[_0x603bdf('0x12')][_0x603bdf('0x7')]?_[_0x603bdf('0x24')](_0x2bb87d[_0x603bdf('0x12')][_0x603bdf('0x7')],function(_0x39e720){const _0x449c9e=_0x603bdf;return{'model':db[_0x39e720[_0x449c9e('0x11')]],'as':_0x39e720['as'],'attributes':_0x39e720[_0x449c9e('0x21')],'include':_0x39e720[_0x449c9e('0x7')]?_[_0x449c9e('0x24')](_0x39e720[_0x449c9e('0x7')],function(_0x35cee6){const _0x479ac4=_0x449c9e;return{'model':db[_0x35cee6[_0x479ac4('0x11')]],'as':_0x35cee6['as'],'attributes':_0x35cee6[_0x479ac4('0x21')],'include':_0x35cee6[_0x479ac4('0x7')]?_[_0x479ac4('0x24')](_0x35cee6['include'],function(_0x34e302){const _0x359546=_0x479ac4;return{'model':db[_0x34e302[_0x359546('0x11')]],'as':_0x34e302['as'],'attributes':_0x34e302[_0x359546('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e69aa){const _0x5dda4f=_0x603bdf;logger[_0x5dda4f('0x1d')]('GetCmHopper',_0x2bb87d),logger[_0x5dda4f('0x2c')](_0x5dda4f('0x1b'),_0x2bb87d,JSON['stringify'](_0x5e69aa)),_0x3665be(_0x5e69aa);})[_0x603bdf('0x35')](function(_0x4a64c5){const _0x5465b5=_0x603bdf;logger[_0x5465b5('0xd')](_0x5465b5('0x1b'),_0x4a64c5[_0x5465b5('0x27')],_0x2bb87d),_0x3a9fa2(_0x238db6[_0x5465b5('0xd')](0x1f4,_0x4a64c5['message']));});});},exports[_0x1816d5('0x3')]=function(_0x42b733){const _0x1ac2e8=this;return new Promise(function(_0xb43b8d,_0x3c7dd9){const _0xccd372=a139_0x47f9;return db[_0xccd372('0x2b')]['findOne']({'raw':_0x42b733['options']?_0x42b733[_0xccd372('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x42b733['options']?_0x42b733[_0xccd372('0x12')][_0xccd372('0x2a')]||null:null,'attributes':_0x42b733['options']?_0x42b733['options']['attributes']||null:null,'include':_0x42b733[_0xccd372('0x12')]?_0x42b733[_0xccd372('0x12')][_0xccd372('0x7')]?_[_0xccd372('0x24')](_0x42b733[_0xccd372('0x12')]['include'],function(_0x4e943){const _0x7226c3=_0xccd372;return{'model':db[_0x4e943['model']],'as':_0x4e943['as'],'attributes':_0x4e943[_0x7226c3('0x21')],'include':_0x4e943['include']?_[_0x7226c3('0x24')](_0x4e943[_0x7226c3('0x7')],function(_0x48f290){const _0x26e276=_0x7226c3;return{'model':db[_0x48f290[_0x26e276('0x11')]],'as':_0x48f290['as'],'attributes':_0x48f290[_0x26e276('0x21')],'include':_0x48f290['include']?_[_0x26e276('0x24')](_0x48f290[_0x26e276('0x7')],function(_0x436ffc){const _0x48808b=_0x26e276;return{'model':db[_0x436ffc[_0x48808b('0x11')]],'as':_0x436ffc['as'],'attributes':_0x436ffc['attributes']};}):[]};}):[]};}):[]:[]})[_0xccd372('0x26')](function(_0x566d31){const _0x2bb9aa=_0xccd372;logger['info'](_0x2bb9aa('0x3'),_0x42b733),logger[_0x2bb9aa('0x2c')]('ShowCmHopper',_0x42b733,JSON['stringify'](_0x566d31)),_0xb43b8d(_0x566d31);})['catch'](function(_0x86c372){const _0x30a87d=_0xccd372;logger[_0x30a87d('0xd')](_0x30a87d('0x3'),_0x86c372[_0x30a87d('0x27')],_0x42b733),_0x3c7dd9(_0x1ac2e8[_0x30a87d('0xd')](0x1f4,_0x86c372[_0x30a87d('0x27')]));});});},exports['CreateCmHopper']=function(_0x4b6913){const _0x287c1b=this;return new Promise(function(_0xc89ad5,_0x4d197c){const _0x5041e1=a139_0x47f9;return db[_0x5041e1('0x2b')][_0x5041e1('0xe')](_0x4b6913[_0x5041e1('0x9')],{'raw':_0x4b6913[_0x5041e1('0x12')]?_0x4b6913['options'][_0x5041e1('0x5')]===undefined?!![]:![]:!![]})[_0x5041e1('0x26')](function(_0x9df7cd){const _0x2b0734=_0x5041e1;logger[_0x2b0734('0x1d')](_0x2b0734('0x20'),_0x4b6913),logger[_0x2b0734('0x2c')]('CreateCmHopper',_0x4b6913,JSON['stringify'](_0x9df7cd)),_0xc89ad5(_0x9df7cd);})[_0x5041e1('0x35')](function(_0x139c3a){const _0x3e5010=_0x5041e1;logger[_0x3e5010('0xd')](_0x3e5010('0x20'),_0x139c3a[_0x3e5010('0x27')],_0x4b6913),_0x4d197c(_0x287c1b['error'](0x1f4,_0x139c3a['message']));});});},exports['UpdateCmHopper']=function(_0x59d793){const _0x4fb1c0=this;return new Promise(function(_0x4be878,_0x3a0fe5){const _0x653b63=a139_0x47f9;return db[_0x653b63('0x2b')][_0x653b63('0x4')](_0x59d793[_0x653b63('0x9')],{'raw':_0x59d793[_0x653b63('0x12')]?_0x59d793[_0x653b63('0x12')][_0x653b63('0x5')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d793[_0x653b63('0x12')]?_0x59d793[_0x653b63('0x12')][_0x653b63('0x2a')]||null:null,'attributes':_0x59d793[_0x653b63('0x12')]?_0x59d793[_0x653b63('0x12')][_0x653b63('0x21')]||null:null,'limit':_0x59d793[_0x653b63('0x12')]?_0x59d793[_0x653b63('0x12')][_0x653b63('0x15')]||null:null})['then'](function(_0x4f209f){const _0x47d650=_0x653b63;logger[_0x47d650('0x1d')](_0x47d650('0x6'),_0x59d793),logger[_0x47d650('0x2c')]('UpdateCmHopper',_0x59d793,JSON[_0x47d650('0x2f')](_0x4f209f)),_0x4be878(_0x4f209f);})[_0x653b63('0x35')](function(_0x256049){const _0x360fa2=_0x653b63;logger[_0x360fa2('0xd')](_0x360fa2('0x6'),_0x256049['message'],_0x59d793),_0x3a0fe5(_0x4fb1c0['error'](0x1f4,_0x256049['message']));});});},exports['DestroyCmHopper']=function(_0x29bf63){const _0x4d59ce=this;return new Promise(function(_0x5bf0e6,_0x351cc4){const _0x125461=a139_0x47f9;return db[_0x125461('0x2b')][_0x125461('0x2e')]({'where':_0x29bf63[_0x125461('0x12')]?_0x29bf63[_0x125461('0x12')][_0x125461('0x2a')]||null:null})['then'](function(_0x557572){const _0x49e420=_0x125461;logger[_0x49e420('0x1d')]('DestroyCmHopper',_0x29bf63),logger[_0x49e420('0x2c')]('DestroyCmHopper',_0x29bf63,JSON[_0x49e420('0x2f')](_0x557572)),_0x5bf0e6(_0x557572);})[_0x125461('0x35')](function(_0x4b277e){const _0x4c4748=_0x125461;logger[_0x4c4748('0xd')](_0x4c4748('0x1a'),_0x4b277e[_0x4c4748('0x27')],_0x29bf63),_0x351cc4(_0x4d59ce[_0x4c4748('0xd')](0x1f4,_0x4b277e[_0x4c4748('0x27')]));});});},exports['GetContactDialer']=function(_0x5dce0a){const _0x293c13=this;return new Promise(function(_0x4678d8,_0x422572){const _0x2d4982=a139_0x47f9;return db[_0x2d4982('0xc')][_0x2d4982('0x0')]()[_0x2d4982('0x26')](function(_0x429524){const _0x17937=_0x2d4982;return db[_0x17937('0x18')][_0x17937('0x1f')](function(_0x34fc81){const _0x58c699=_0x17937;return db[_0x58c699('0x2b')]['findAll']({'where':_0x5dce0a[_0x58c699('0x12')]?_0x5dce0a[_0x58c699('0x12')]['where']||null:null,'attributes':_0x5dce0a[_0x58c699('0x12')]?_0x5dce0a[_0x58c699('0x12')][_0x58c699('0x21')]||null:null,'limit':_0x5dce0a['options']?_0x5dce0a[_0x58c699('0x12')][_0x58c699('0x15')]||null:null,'order':_0x5dce0a['options']?_0x5dce0a[_0x58c699('0x12')][_0x58c699('0x2')]||null:null,'transaction':_0x34fc81,'lock':_0x34fc81[_0x58c699('0x33')][_0x58c699('0x28')],'include':[{'model':db[_0x58c699('0xc')],'as':_0x58c699('0x1'),'attributes':_[_0x58c699('0x37')](_0x429524)},{'model':db[_0x58c699('0x17')],'as':_0x58c699('0x30'),'attributes':['id','name',_0x58c699('0xf')]}]})['then'](function(_0xf1b7cf){const _0x5712b4=_0x58c699,_0xc9b91e=[],_0x4d612c=[];for(let _0x2bf1d9=0x0;_0x2bf1d9<_0xf1b7cf[_0x5712b4('0x14')];_0x2bf1d9+=0x1){!_0x4d612c[_0x5712b4('0x16')](_0xf1b7cf[_0x2bf1d9]['UserId'])&&(_0x4d612c[_0x5712b4('0xa')](_0xf1b7cf[_0x2bf1d9]['UserId']),_0xc9b91e[_0x5712b4('0xa')](_0xf1b7cf[_0x2bf1d9][_0x5712b4('0x4')](_0x5dce0a['body'],{'transaction':_0x34fc81})));}return Promise[_0x5712b4('0x2d')](_0xc9b91e);});})['then'](function(_0x2b6cac){const _0x151e41=_0x17937;logger['info'](_0x151e41('0x22'),_0x5dce0a),logger['debug'](_0x151e41('0x22'),_0x5dce0a,JSON[_0x151e41('0x2f')](_0x2b6cac)),_0x4678d8(_0x2b6cac);})['catch'](function(_0xfc089f){const _0x1b3303=_0x17937;logger['error'](_0x1b3303('0x22'),_0xfc089f[_0x1b3303('0x27')],_0x5dce0a),_0x422572(_0x293c13[_0x1b3303('0xd')](0x1f4,_0xfc089f[_0x1b3303('0x27')]));});});});},exports['MoveContactManagedDialer']=function(_0x4f8b99){const _0x2fbb9e=this;return new Promise(function(_0x586691,_0x3ce5fa){const _0x5d1b84=a139_0x47f9;return db[_0x5d1b84('0x18')][_0x5d1b84('0x1f')](function(_0x13647c){const _0x335948=_0x5d1b84;return db[_0x335948('0x23')]['create'](_0x4f8b99[_0x335948('0x9')],{'raw':_0x4f8b99[_0x335948('0x12')]?_0x4f8b99['options'][_0x335948('0x5')]===undefined?!![]:![]:!![],'transaction':_0x13647c})[_0x335948('0x26')](function(){const _0xf29ba4=_0x335948;return db[_0xf29ba4('0x2b')]['destroy']({'where':_0x4f8b99['options']?_0x4f8b99[_0xf29ba4('0x12')][_0xf29ba4('0x2a')]||null:null,'transaction':_0x13647c});});})['then'](function(_0x418e68){const _0xe233a9=_0x5d1b84;logger[_0xe233a9('0x1d')]('MoveContactManagedDialer',_0x4f8b99),logger[_0xe233a9('0x2c')](_0xe233a9('0x32'),_0x4f8b99,JSON[_0xe233a9('0x2f')](_0x418e68)),_0x586691(_0x418e68);})[_0x5d1b84('0x35')](function(_0x8ed34b){const _0x40fe0b=_0x5d1b84;logger['error']('MoveContactManagedDialer',_0x8ed34b[_0x40fe0b('0x27')],_0x4f8b99),_0x3ce5fa(_0x2fbb9e[_0x40fe0b('0xd')](0x1f4,_0x8ed34b[_0x40fe0b('0x27')]));});});},exports[_0x1816d5('0xb')]=function(_0x6b8483){const _0x4e2857=this;return new Promise(function(_0x30df09,_0x5bee1e){const _0x49bed1=a139_0x47f9;return db[_0x49bed1('0x2b')]['findAll']({'raw':_0x6b8483[_0x49bed1('0x12')]?_0x6b8483['options'][_0x49bed1('0x5')]===undefined?!![]:![]:!![],'where':_0x6b8483[_0x49bed1('0x12')]?_0x6b8483[_0x49bed1('0x12')]['where']||null:null,'attributes':[[fn(_0x49bed1('0x36'),fn('IF',literal(_0x49bed1('0x13')+util[_0x49bed1('0x8')](_0x49bed1('0x1e'),moment()[_0x49bed1('0x8')](_0x49bed1('0x34')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x3d2f8c){const _0x2b475a=_0x49bed1;logger[_0x2b475a('0x1d')](_0x2b475a('0xb'),_0x6b8483),logger[_0x2b475a('0x2c')](_0x2b475a('0xb'),_0x6b8483,JSON[_0x2b475a('0x2f')](_0x3d2f8c)),_0x30df09(_0x3d2f8c);})[_0x49bed1('0x35')](function(_0x3fbe89){const _0x4dd299=_0x49bed1;logger[_0x4dd299('0xd')](_0x4dd299('0xb'),_0x3fbe89[_0x4dd299('0x27')],_0x6b8483),_0x5bee1e(_0x4e2857[_0x4dd299('0xd')](0x1f4,_0x3fbe89[_0x4dd299('0x27')]));});});},exports[_0x1816d5('0x25')]=function(_0x34ed9f){const _0x1d069b=this;return new Promise(function(_0x15b8e3,_0x2059ee){const _0x380e64=a139_0x47f9;return db['CmContact']['describe']()[_0x380e64('0x26')](function(){const _0x484cfe=_0x380e64;return db[_0x484cfe('0x18')][_0x484cfe('0x1f')](function(_0x2de3c2){const _0xd38ed6=_0x484cfe;return db[_0xd38ed6('0x2b')][_0xd38ed6('0x10')]({'where':_0x34ed9f['options']?_0x34ed9f[_0xd38ed6('0x12')][_0xd38ed6('0x2a')]||null:null,'attributes':_0x34ed9f[_0xd38ed6('0x12')]?_0x34ed9f[_0xd38ed6('0x12')][_0xd38ed6('0x21')]||null:null,'limit':0x1,'order':_0x34ed9f['options']?_0x34ed9f[_0xd38ed6('0x12')][_0xd38ed6('0x2')]||null:null,'group':db[_0xd38ed6('0x2b')]['UserId'],'transaction':_0x2de3c2,'lock':_0x2de3c2[_0xd38ed6('0x33')]['UPDATE'],'include':_0x34ed9f[_0xd38ed6('0x12')]?_0x34ed9f[_0xd38ed6('0x12')]['include']?_['map'](_0x34ed9f[_0xd38ed6('0x12')][_0xd38ed6('0x7')],function(_0xbc3fe4){const _0x24a55f=_0xd38ed6;return{'model':db[_0xbc3fe4[_0x24a55f('0x11')]],'as':_0xbc3fe4['as'],'attributes':_0xbc3fe4[_0x24a55f('0x21')],'include':_0xbc3fe4[_0x24a55f('0x7')]?_[_0x24a55f('0x24')](_0xbc3fe4[_0x24a55f('0x7')],function(_0x41b1a4){const _0x2ff60e=_0x24a55f;return{'model':db[_0x41b1a4[_0x2ff60e('0x11')]],'as':_0x41b1a4['as'],'attributes':_0x41b1a4[_0x2ff60e('0x21')],'include':_0x41b1a4[_0x2ff60e('0x7')]?_[_0x2ff60e('0x24')](_0x41b1a4[_0x2ff60e('0x7')],function(_0xc4c132){const _0x52d2f7=_0x2ff60e;return{'model':db[_0xc4c132[_0x52d2f7('0x11')]],'as':_0xc4c132['as'],'attributes':_0xc4c132[_0x52d2f7('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd38ed6('0x26')](function(_0xdee7f5){const _0x4cdb6e=_0xd38ed6,_0x1d423c=[];for(let _0x1e3937=0x0;_0x1e3937<_0xdee7f5[_0x4cdb6e('0x14')];_0x1e3937+=0x1){_0x1d423c[_0x4cdb6e('0xa')](_0xdee7f5[_0x1e3937]['update'](_0x34ed9f[_0x4cdb6e('0x9')],{'transaction':_0x2de3c2}));}return Promise[_0x4cdb6e('0x2d')](_0x1d423c);});})[_0x484cfe('0x26')](function(_0x374de1){const _0x43abea=_0x484cfe;logger['info'](_0x43abea('0x25'),_0x34ed9f),logger['debug'](_0x43abea('0x25'),_0x34ed9f,JSON[_0x43abea('0x2f')](_0x374de1)),_0x15b8e3(_0x374de1);})[_0x484cfe('0x35')](function(_0x556d6f){const _0x35cc9d=_0x484cfe;logger['error'](_0x35cc9d('0x25'),_0x556d6f[_0x35cc9d('0x27')],_0x34ed9f),_0x2059ee(_0x1d069b['error'](0x1f4,_0x556d6f[_0x35cc9d('0x27')]));});});});},exports[_0x1816d5('0x29')]=function(_0x4a8e11){const _0x13f2a2=this;return new Promise(function(_0x1086f2,_0x5c4150){const _0x1ca988=a139_0x47f9;db[_0x1ca988('0xc')][_0x1ca988('0x0')]()[_0x1ca988('0x26')](function(_0x388ebe){const _0x35c512=_0x1ca988;return db[_0x35c512('0x2b')][_0x35c512('0x10')]({'raw':_0x4a8e11['options']?_0x4a8e11['options'][_0x35c512('0x5')]===undefined?!![]:![]:!![],'where':_0x4a8e11[_0x35c512('0x12')]?_0x4a8e11[_0x35c512('0x12')][_0x35c512('0x2a')]||null:null,'attributes':_0x4a8e11[_0x35c512('0x12')]?_0x4a8e11[_0x35c512('0x12')][_0x35c512('0x21')]||null:null,'limit':_0x4a8e11[_0x35c512('0x12')]?_0x4a8e11[_0x35c512('0x12')]['limit']||null:null,'include':_0x4a8e11[_0x35c512('0x12')]?_0x4a8e11['options'][_0x35c512('0x7')]?_[_0x35c512('0x24')](_0x4a8e11[_0x35c512('0x12')][_0x35c512('0x7')],function(_0x46dac4){const _0x5eb003=_0x35c512;return{'model':db[_0x46dac4[_0x5eb003('0x11')]],'as':_0x46dac4['as'],'attributes':_0x46dac4['as']===_0x5eb003('0x1')?_[_0x5eb003('0x37')](_0x388ebe):_0x46dac4[_0x5eb003('0x21')],'include':_0x46dac4[_0x5eb003('0x7')]?_['map'](_0x46dac4[_0x5eb003('0x7')],function(_0x5d7a48){const _0x2fb883=_0x5eb003;return{'model':db[_0x5d7a48[_0x2fb883('0x11')]],'as':_0x5d7a48['as'],'attributes':_0x5d7a48[_0x2fb883('0x21')],'include':_0x5d7a48[_0x2fb883('0x7')]?_[_0x2fb883('0x24')](_0x5d7a48[_0x2fb883('0x7')],function(_0x4e7b8c){const _0x5a45bf=_0x2fb883;return{'model':db[_0x4e7b8c['model']],'as':_0x4e7b8c['as'],'attributes':_0x4e7b8c[_0x5a45bf('0x21')]};}):[]};}):[]};}):[]:[]})[_0x35c512('0x26')](function(_0x40837e){const _0x52491f=_0x35c512;logger[_0x52491f('0x1d')](_0x52491f('0x1b'),_0x4a8e11),logger[_0x52491f('0x2c')](_0x52491f('0x1b'),_0x4a8e11,JSON['stringify'](_0x40837e)),_0x1086f2(_0x40837e);})[_0x35c512('0x35')](function(_0x7e270e){const _0xc823f8=_0x35c512;logger[_0xc823f8('0xd')](_0xc823f8('0x1b'),_0x7e270e['message'],_0x4a8e11),_0x5c4150(_0x13f2a2['error'](0x1f4,_0x7e270e[_0xc823f8('0x27')]));});});});};
\ No newline at end of file
+const a139_0x2885=['voicePause','order','GetContactDialer','GetContactRecallMe','CreateCmHopper','raw','UpdateCmHopper','includes','all','keys','transaction','model','findOne','contactsRescheduled','limit','format','../../mysqldb','Contact','CmHopperFinal','describe','COUNT','MoveContactManagedDialer','update','\x22%s\x22','length','map','sequelize','CountReScheduled','stringify','GetCmHopper','rpc','attributes','error','body','options','then','destroy','ShowCmHopper','debug','info','create','message','CmContact','catch','CmHopper','util','UserId','DestroyCmHopper','User','LOCK','UPDATE','findAll','include','where','push'];(function(_0x338721,_0x288548){const _0x54d9ad=function(_0x1f26ed){while(--_0x1f26ed){_0x338721['push'](_0x338721['shift']());}};_0x54d9ad(++_0x288548);}(a139_0x2885,0xf4));const a139_0x54d9=function(_0x338721,_0x288548){_0x338721=_0x338721-0x0;let _0x54d9ad=a139_0x2885[_0x338721];return _0x54d9ad;};const _0x5dd9cd=a139_0x54d9;'use strict';const _=require('lodash'),util=require(_0x5dd9cd('0x15')),moment=require('moment'),db=require(_0x5dd9cd('0x2f'))['db'],logger=require('../../config/logger')(_0x5dd9cd('0x6')),{literal,fn}=require('sequelize');exports[_0x5dd9cd('0x5')]=function(_0x1f26ed){const _0x5d2c25=this;return new Promise(function(_0x207c83,_0x147bb6){const _0x18c707=a139_0x54d9;return db[_0x18c707('0x14')][_0x18c707('0x1b')]({'raw':_0x1f26ed[_0x18c707('0xa')]?_0x1f26ed[_0x18c707('0xa')][_0x18c707('0x24')]===undefined?!![]:![]:!![],'where':_0x1f26ed[_0x18c707('0xa')]?_0x1f26ed['options']['where']||null:null,'attributes':_0x1f26ed[_0x18c707('0xa')]?_0x1f26ed[_0x18c707('0xa')][_0x18c707('0x7')]||null:null,'limit':_0x1f26ed['options']?_0x1f26ed['options'][_0x18c707('0x2d')]||null:null,'include':_0x1f26ed[_0x18c707('0xa')]?_0x1f26ed[_0x18c707('0xa')][_0x18c707('0x1c')]?_['map'](_0x1f26ed[_0x18c707('0xa')][_0x18c707('0x1c')],function(_0x28d70c){const _0x5675aa=_0x18c707;return{'model':db[_0x28d70c[_0x5675aa('0x2a')]],'as':_0x28d70c['as'],'attributes':_0x28d70c[_0x5675aa('0x7')],'include':_0x28d70c['include']?_[_0x5675aa('0x1')](_0x28d70c[_0x5675aa('0x1c')],function(_0x1795d7){const _0x4257b0=_0x5675aa;return{'model':db[_0x1795d7[_0x4257b0('0x2a')]],'as':_0x1795d7['as'],'attributes':_0x1795d7['attributes'],'include':_0x1795d7[_0x4257b0('0x1c')]?_['map'](_0x1795d7[_0x4257b0('0x1c')],function(_0xcb60c2){const _0x302062=_0x4257b0;return{'model':db[_0xcb60c2[_0x302062('0x2a')]],'as':_0xcb60c2['as'],'attributes':_0xcb60c2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x10f2e5){const _0x52c1e6=_0x18c707;logger['info'](_0x52c1e6('0x5'),_0x1f26ed),logger[_0x52c1e6('0xe')]('GetCmHopper',_0x1f26ed,JSON[_0x52c1e6('0x4')](_0x10f2e5)),_0x207c83(_0x10f2e5);})['catch'](function(_0x42f401){const _0x2c06de=_0x18c707;logger[_0x2c06de('0x8')](_0x2c06de('0x5'),_0x42f401[_0x2c06de('0x11')],_0x1f26ed),_0x147bb6(_0x5d2c25[_0x2c06de('0x8')](0x1f4,_0x42f401[_0x2c06de('0x11')]));});});},exports[_0x5dd9cd('0xd')]=function(_0x26c83f){const _0x3d538c=this;return new Promise(function(_0xd59cf7,_0xcab64c){const _0x59aaf6=a139_0x54d9;return db[_0x59aaf6('0x14')][_0x59aaf6('0x2b')]({'raw':_0x26c83f[_0x59aaf6('0xa')]?_0x26c83f[_0x59aaf6('0xa')][_0x59aaf6('0x24')]===undefined?!![]:![]:!![],'where':_0x26c83f['options']?_0x26c83f[_0x59aaf6('0xa')]['where']||null:null,'attributes':_0x26c83f[_0x59aaf6('0xa')]?_0x26c83f[_0x59aaf6('0xa')][_0x59aaf6('0x7')]||null:null,'include':_0x26c83f[_0x59aaf6('0xa')]?_0x26c83f[_0x59aaf6('0xa')][_0x59aaf6('0x1c')]?_[_0x59aaf6('0x1')](_0x26c83f[_0x59aaf6('0xa')][_0x59aaf6('0x1c')],function(_0x2a79c8){const _0x8358f6=_0x59aaf6;return{'model':db[_0x2a79c8[_0x8358f6('0x2a')]],'as':_0x2a79c8['as'],'attributes':_0x2a79c8[_0x8358f6('0x7')],'include':_0x2a79c8['include']?_[_0x8358f6('0x1')](_0x2a79c8['include'],function(_0x1f2ace){const _0x477037=_0x8358f6;return{'model':db[_0x1f2ace[_0x477037('0x2a')]],'as':_0x1f2ace['as'],'attributes':_0x1f2ace[_0x477037('0x7')],'include':_0x1f2ace['include']?_['map'](_0x1f2ace[_0x477037('0x1c')],function(_0xb5a32b){const _0x1c9b59=_0x477037;return{'model':db[_0xb5a32b['model']],'as':_0xb5a32b['as'],'attributes':_0xb5a32b[_0x1c9b59('0x7')]};}):[]};}):[]};}):[]:[]})[_0x59aaf6('0xb')](function(_0x430c90){const _0x42f19a=_0x59aaf6;logger[_0x42f19a('0xf')]('ShowCmHopper',_0x26c83f),logger[_0x42f19a('0xe')](_0x42f19a('0xd'),_0x26c83f,JSON[_0x42f19a('0x4')](_0x430c90)),_0xd59cf7(_0x430c90);})['catch'](function(_0x41beaa){const _0x14455e=_0x59aaf6;logger[_0x14455e('0x8')](_0x14455e('0xd'),_0x41beaa['message'],_0x26c83f),_0xcab64c(_0x3d538c['error'](0x1f4,_0x41beaa[_0x14455e('0x11')]));});});},exports[_0x5dd9cd('0x23')]=function(_0x13a01f){const _0x5aa22a=this;return new Promise(function(_0x35be50,_0x1af714){const _0x3b70a=a139_0x54d9;return db[_0x3b70a('0x14')][_0x3b70a('0x10')](_0x13a01f[_0x3b70a('0x9')],{'raw':_0x13a01f['options']?_0x13a01f[_0x3b70a('0xa')][_0x3b70a('0x24')]===undefined?!![]:![]:!![]})[_0x3b70a('0xb')](function(_0x2584de){const _0x2b99aa=_0x3b70a;logger['info'](_0x2b99aa('0x23'),_0x13a01f),logger['debug'](_0x2b99aa('0x23'),_0x13a01f,JSON[_0x2b99aa('0x4')](_0x2584de)),_0x35be50(_0x2584de);})[_0x3b70a('0x13')](function(_0x1f8ad6){const _0x1d7c5d=_0x3b70a;logger[_0x1d7c5d('0x8')]('CreateCmHopper',_0x1f8ad6[_0x1d7c5d('0x11')],_0x13a01f),_0x1af714(_0x5aa22a['error'](0x1f4,_0x1f8ad6[_0x1d7c5d('0x11')]));});});},exports[_0x5dd9cd('0x25')]=function(_0x5de4ec){const _0x1cc2fc=this;return new Promise(function(_0x832665,_0x44c61d){const _0x5ad98f=a139_0x54d9;return db[_0x5ad98f('0x14')]['update'](_0x5de4ec[_0x5ad98f('0x9')],{'raw':_0x5de4ec[_0x5ad98f('0xa')]?_0x5de4ec['options'][_0x5ad98f('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5de4ec['options']?_0x5de4ec[_0x5ad98f('0xa')][_0x5ad98f('0x1d')]||null:null,'attributes':_0x5de4ec[_0x5ad98f('0xa')]?_0x5de4ec[_0x5ad98f('0xa')][_0x5ad98f('0x7')]||null:null,'limit':_0x5de4ec[_0x5ad98f('0xa')]?_0x5de4ec[_0x5ad98f('0xa')][_0x5ad98f('0x2d')]||null:null})[_0x5ad98f('0xb')](function(_0x6ee5b){const _0x4c5bc4=_0x5ad98f;logger['info']('UpdateCmHopper',_0x5de4ec),logger['debug'](_0x4c5bc4('0x25'),_0x5de4ec,JSON[_0x4c5bc4('0x4')](_0x6ee5b)),_0x832665(_0x6ee5b);})[_0x5ad98f('0x13')](function(_0x2ebcc5){const _0x242c53=_0x5ad98f;logger[_0x242c53('0x8')](_0x242c53('0x25'),_0x2ebcc5['message'],_0x5de4ec),_0x44c61d(_0x1cc2fc[_0x242c53('0x8')](0x1f4,_0x2ebcc5['message']));});});},exports['DestroyCmHopper']=function(_0x4826be){const _0x538615=this;return new Promise(function(_0x34fc28,_0x5b22f4){const _0x4eea6d=a139_0x54d9;return db[_0x4eea6d('0x14')][_0x4eea6d('0xc')]({'where':_0x4826be[_0x4eea6d('0xa')]?_0x4826be[_0x4eea6d('0xa')][_0x4eea6d('0x1d')]||null:null})[_0x4eea6d('0xb')](function(_0x1ffba7){const _0x4a7f1f=_0x4eea6d;logger[_0x4a7f1f('0xf')](_0x4a7f1f('0x17'),_0x4826be),logger[_0x4a7f1f('0xe')](_0x4a7f1f('0x17'),_0x4826be,JSON[_0x4a7f1f('0x4')](_0x1ffba7)),_0x34fc28(_0x1ffba7);})[_0x4eea6d('0x13')](function(_0x1e2c75){const _0x238e95=_0x4eea6d;logger[_0x238e95('0x8')](_0x238e95('0x17'),_0x1e2c75[_0x238e95('0x11')],_0x4826be),_0x5b22f4(_0x538615[_0x238e95('0x8')](0x1f4,_0x1e2c75[_0x238e95('0x11')]));});});},exports[_0x5dd9cd('0x21')]=function(_0x342941){const _0x678cab=this;return new Promise(function(_0x3e2416,_0x3eccb3){const _0x290b1a=a139_0x54d9;return db[_0x290b1a('0x12')][_0x290b1a('0x32')]()[_0x290b1a('0xb')](function(_0x3e331c){const _0xbf5e22=_0x290b1a;return db[_0xbf5e22('0x2')][_0xbf5e22('0x29')](function(_0x126a22){const _0x489970=_0xbf5e22;return db[_0x489970('0x14')][_0x489970('0x1b')]({'where':_0x342941[_0x489970('0xa')]?_0x342941[_0x489970('0xa')]['where']||null:null,'attributes':_0x342941[_0x489970('0xa')]?_0x342941[_0x489970('0xa')]['attributes']||null:null,'limit':_0x342941[_0x489970('0xa')]?_0x342941['options'][_0x489970('0x2d')]||null:null,'order':_0x342941[_0x489970('0xa')]?_0x342941[_0x489970('0xa')][_0x489970('0x20')]||null:null,'transaction':_0x126a22,'lock':_0x126a22[_0x489970('0x19')][_0x489970('0x1a')],'include':[{'model':db[_0x489970('0x12')],'as':_0x489970('0x30'),'attributes':_[_0x489970('0x28')](_0x3e331c)},{'model':db[_0x489970('0x18')],'as':'Agent','attributes':['id','name',_0x489970('0x1f')]}]})[_0x489970('0xb')](function(_0x377f35){const _0x2a8f7b=_0x489970,_0x1cafc1=[],_0x137f82=[];for(let _0x40efaf=0x0;_0x40efaf<_0x377f35[_0x2a8f7b('0x0')];_0x40efaf+=0x1){!_0x137f82[_0x2a8f7b('0x26')](_0x377f35[_0x40efaf][_0x2a8f7b('0x16')])&&(_0x137f82[_0x2a8f7b('0x1e')](_0x377f35[_0x40efaf][_0x2a8f7b('0x16')]),_0x1cafc1[_0x2a8f7b('0x1e')](_0x377f35[_0x40efaf][_0x2a8f7b('0x35')](_0x342941[_0x2a8f7b('0x9')],{'transaction':_0x126a22})));}return Promise[_0x2a8f7b('0x27')](_0x1cafc1);});})[_0xbf5e22('0xb')](function(_0x56739e){const _0x341224=_0xbf5e22;logger[_0x341224('0xf')](_0x341224('0x21'),_0x342941),logger[_0x341224('0xe')](_0x341224('0x21'),_0x342941,JSON[_0x341224('0x4')](_0x56739e)),_0x3e2416(_0x56739e);})[_0xbf5e22('0x13')](function(_0x14dbb1){const _0x1210e1=_0xbf5e22;logger[_0x1210e1('0x8')](_0x1210e1('0x21'),_0x14dbb1[_0x1210e1('0x11')],_0x342941),_0x3eccb3(_0x678cab[_0x1210e1('0x8')](0x1f4,_0x14dbb1[_0x1210e1('0x11')]));});});});},exports[_0x5dd9cd('0x34')]=function(_0x38195a){const _0x3837bc=this;return new Promise(function(_0x1c2381,_0x876e83){const _0x5a7931=a139_0x54d9;return db[_0x5a7931('0x2')][_0x5a7931('0x29')](function(_0x33739d){const _0x19d763=_0x5a7931;return db[_0x19d763('0x31')][_0x19d763('0x10')](_0x38195a['body'],{'raw':_0x38195a[_0x19d763('0xa')]?_0x38195a[_0x19d763('0xa')][_0x19d763('0x24')]===undefined?!![]:![]:!![],'transaction':_0x33739d})[_0x19d763('0xb')](function(){const _0x37fb5c=_0x19d763;return db[_0x37fb5c('0x14')][_0x37fb5c('0xc')]({'where':_0x38195a[_0x37fb5c('0xa')]?_0x38195a[_0x37fb5c('0xa')]['where']||null:null,'transaction':_0x33739d});});})['then'](function(_0x4cdab2){const _0xb898c3=_0x5a7931;logger[_0xb898c3('0xf')](_0xb898c3('0x34'),_0x38195a),logger[_0xb898c3('0xe')]('MoveContactManagedDialer',_0x38195a,JSON[_0xb898c3('0x4')](_0x4cdab2)),_0x1c2381(_0x4cdab2);})['catch'](function(_0x5cb985){const _0x4a86da=_0x5a7931;logger[_0x4a86da('0x8')]('MoveContactManagedDialer',_0x5cb985['message'],_0x38195a),_0x876e83(_0x3837bc[_0x4a86da('0x8')](0x1f4,_0x5cb985[_0x4a86da('0x11')]));});});},exports[_0x5dd9cd('0x3')]=function(_0x46d76c){const _0x55372c=this;return new Promise(function(_0x1256e8,_0x4743e3){const _0x590898=a139_0x54d9;return db['CmHopper'][_0x590898('0x1b')]({'raw':_0x46d76c['options']?_0x46d76c[_0x590898('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x46d76c['options']?_0x46d76c[_0x590898('0xa')]['where']||null:null,'attributes':[[fn(_0x590898('0x33'),fn('IF',literal('`scheduledat`\x20>=\x20'+util['format'](_0x590898('0x36'),moment()[_0x590898('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x590898('0x2c')]]})[_0x590898('0xb')](function(_0x14b8be){const _0x40322f=_0x590898;logger[_0x40322f('0xf')](_0x40322f('0x3'),_0x46d76c),logger[_0x40322f('0xe')]('CountReScheduled',_0x46d76c,JSON[_0x40322f('0x4')](_0x14b8be)),_0x1256e8(_0x14b8be);})['catch'](function(_0x3eb0fb){const _0x5832d2=_0x590898;logger[_0x5832d2('0x8')](_0x5832d2('0x3'),_0x3eb0fb[_0x5832d2('0x11')],_0x46d76c),_0x4743e3(_0x55372c[_0x5832d2('0x8')](0x1f4,_0x3eb0fb['message']));});});},exports['GetContactRecallMe']=function(_0x2f9603){const _0x39fa29=this;return new Promise(function(_0x216c7d,_0x577628){const _0x210e44=a139_0x54d9;return db['CmContact'][_0x210e44('0x32')]()[_0x210e44('0xb')](function(){const _0x45b252=_0x210e44;return db[_0x45b252('0x2')][_0x45b252('0x29')](function(_0x1002d4){const _0x488a24=_0x45b252;return db['CmHopper']['findAll']({'where':_0x2f9603[_0x488a24('0xa')]?_0x2f9603[_0x488a24('0xa')]['where']||null:null,'attributes':_0x2f9603[_0x488a24('0xa')]?_0x2f9603['options'][_0x488a24('0x7')]||null:null,'limit':0x1,'order':_0x2f9603[_0x488a24('0xa')]?_0x2f9603[_0x488a24('0xa')][_0x488a24('0x20')]||null:null,'group':db[_0x488a24('0x14')]['UserId'],'transaction':_0x1002d4,'lock':_0x1002d4[_0x488a24('0x19')][_0x488a24('0x1a')],'include':_0x2f9603[_0x488a24('0xa')]?_0x2f9603[_0x488a24('0xa')]['include']?_[_0x488a24('0x1')](_0x2f9603[_0x488a24('0xa')][_0x488a24('0x1c')],function(_0xdefbed){const _0x299872=_0x488a24;return{'model':db[_0xdefbed['model']],'as':_0xdefbed['as'],'attributes':_0xdefbed[_0x299872('0x7')],'include':_0xdefbed[_0x299872('0x1c')]?_[_0x299872('0x1')](_0xdefbed[_0x299872('0x1c')],function(_0x5f52bd){const _0x536cc3=_0x299872;return{'model':db[_0x5f52bd['model']],'as':_0x5f52bd['as'],'attributes':_0x5f52bd['attributes'],'include':_0x5f52bd[_0x536cc3('0x1c')]?_[_0x536cc3('0x1')](_0x5f52bd[_0x536cc3('0x1c')],function(_0x3447dc){const _0x4c7238=_0x536cc3;return{'model':db[_0x3447dc[_0x4c7238('0x2a')]],'as':_0x3447dc['as'],'attributes':_0x3447dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x488a24('0xb')](function(_0x5814da){const _0x105e4e=_0x488a24,_0x2b42f2=[];for(let _0xb1a3a3=0x0;_0xb1a3a3<_0x5814da['length'];_0xb1a3a3+=0x1){_0x2b42f2['push'](_0x5814da[_0xb1a3a3][_0x105e4e('0x35')](_0x2f9603[_0x105e4e('0x9')],{'transaction':_0x1002d4}));}return Promise[_0x105e4e('0x27')](_0x2b42f2);});})['then'](function(_0x122b7f){const _0x8feb9=_0x45b252;logger[_0x8feb9('0xf')]('GetContactRecallMe',_0x2f9603),logger[_0x8feb9('0xe')](_0x8feb9('0x22'),_0x2f9603,JSON[_0x8feb9('0x4')](_0x122b7f)),_0x216c7d(_0x122b7f);})['catch'](function(_0x8eb23a){const _0x107612=_0x45b252;logger[_0x107612('0x8')](_0x107612('0x22'),_0x8eb23a[_0x107612('0x11')],_0x2f9603),_0x577628(_0x39fa29[_0x107612('0x8')](0x1f4,_0x8eb23a['message']));});});});},exports['GetCmHopperPreview']=function(_0x1a989f){const _0x27220f=this;return new Promise(function(_0x1c25ec,_0x5af92c){const _0x2f0115=a139_0x54d9;db['CmContact'][_0x2f0115('0x32')]()[_0x2f0115('0xb')](function(_0x2109d4){const _0x1d9b7f=_0x2f0115;return db[_0x1d9b7f('0x14')]['findAll']({'raw':_0x1a989f[_0x1d9b7f('0xa')]?_0x1a989f[_0x1d9b7f('0xa')][_0x1d9b7f('0x24')]===undefined?!![]:![]:!![],'where':_0x1a989f[_0x1d9b7f('0xa')]?_0x1a989f[_0x1d9b7f('0xa')]['where']||null:null,'attributes':_0x1a989f[_0x1d9b7f('0xa')]?_0x1a989f['options'][_0x1d9b7f('0x7')]||null:null,'limit':_0x1a989f[_0x1d9b7f('0xa')]?_0x1a989f[_0x1d9b7f('0xa')]['limit']||null:null,'include':_0x1a989f[_0x1d9b7f('0xa')]?_0x1a989f[_0x1d9b7f('0xa')][_0x1d9b7f('0x1c')]?_[_0x1d9b7f('0x1')](_0x1a989f[_0x1d9b7f('0xa')][_0x1d9b7f('0x1c')],function(_0x2444e6){const _0x10c89a=_0x1d9b7f;return{'model':db[_0x2444e6['model']],'as':_0x2444e6['as'],'attributes':_0x2444e6['as']===_0x10c89a('0x30')?_[_0x10c89a('0x28')](_0x2109d4):_0x2444e6[_0x10c89a('0x7')],'include':_0x2444e6[_0x10c89a('0x1c')]?_[_0x10c89a('0x1')](_0x2444e6[_0x10c89a('0x1c')],function(_0x3a3128){const _0x32439d=_0x10c89a;return{'model':db[_0x3a3128[_0x32439d('0x2a')]],'as':_0x3a3128['as'],'attributes':_0x3a3128[_0x32439d('0x7')],'include':_0x3a3128['include']?_[_0x32439d('0x1')](_0x3a3128[_0x32439d('0x1c')],function(_0x4488d5){return{'model':db[_0x4488d5['model']],'as':_0x4488d5['as'],'attributes':_0x4488d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d9b7f('0xb')](function(_0x281d0c){const _0x4c756c=_0x1d9b7f;logger[_0x4c756c('0xf')](_0x4c756c('0x5'),_0x1a989f),logger[_0x4c756c('0xe')](_0x4c756c('0x5'),_0x1a989f,JSON[_0x4c756c('0x4')](_0x281d0c)),_0x1c25ec(_0x281d0c);})[_0x1d9b7f('0x13')](function(_0x15ed26){const _0x5d3378=_0x1d9b7f;logger[_0x5d3378('0x8')](_0x5d3378('0x5'),_0x15ed26[_0x5d3378('0x11')],_0x1a989f),_0x5af92c(_0x27220f[_0x5d3378('0x8')](0x1f4,_0x15ed26[_0x5d3378('0x11')]));});});});};
\ No newline at end of file