Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / userNotification / userNotification.controller.js
index fd2ae6b..4b95880 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf683=['sequelize','transaction','UserNotification','create','forEach','Template','html','startCase','User','union','ids','queue','replace','Queue','push','all','catch','findOne','getAgents','map','eml-format','rimraf','request-promise','moment','bluebird','path','sox','ejs','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','sendUserNotification','body','text','TemplateId','Sequelize','ValidationError','hasOwnProperty','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join'];(function(_0x3eadb9,_0x396b2e){var _0x56e053=function(_0x2ef350){while(--_0x2ef350){_0x3eadb9['push'](_0x3eadb9['shift']());}};_0x56e053(++_0x396b2e);}(_0xf683,0xca));var _0x3f68=function(_0x359bde,_0x37882f){_0x359bde=_0x359bde-0x0;var _0x632a6a=_0xf683[_0x359bde];return _0x632a6a;};'use strict';var emlformat=require(_0x3f68('0x0'));var rimraf=require(_0x3f68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f68('0x2'));var moment=require(_0x3f68('0x3'));var BPromise=require(_0x3f68('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f68('0x5'));var sox=require(_0x3f68('0x6'));var csv=require('to-csv');var ejs=require(_0x3f68('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f68('0x8'));var deskjs=require(_0x3f68('0x9'));var toCsv=require(_0x3f68('0xa'));var querystring=require(_0x3f68('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3f68('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x3f68('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f68('0xe'))(_0x3f68('0xf'));var utils=require(_0x3f68('0x10'));var config=require(_0x3f68('0x11'));var licenseUtil=require(_0x3f68('0x12'));var db=require(_0x3f68('0x13'))['db'];config[_0x3f68('0x14')]=_[_0x3f68('0x15')](config[_0x3f68('0x14')],{'host':_0x3f68('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x3f68('0x17')](socket);function respondWithStatusCode(_0xb8c026,_0x4a9385){_0x4a9385=_0x4a9385||0xcc;return function(_0x273808){if(_0x273808){return _0xb8c026[_0x3f68('0x18')](_0x4a9385);}return _0xb8c026[_0x3f68('0x19')](_0x4a9385)[_0x3f68('0x1a')]();};}function respondWithResult(_0x150230,_0x2126a0){_0x2126a0=_0x2126a0||0xc8;return function(_0x558cd7){if(_0x558cd7){return _0x150230[_0x3f68('0x19')](_0x2126a0)['json'](_0x558cd7);}};}function respondWithFilteredResult(_0x4580f8,_0x92e7d6){return function(_0x169562){if(_0x169562){var _0x1d5366=typeof _0x92e7d6[_0x3f68('0x1b')]===_0x3f68('0x1c')&&typeof _0x92e7d6[_0x3f68('0x1d')]==='undefined';var _0x4bb828=_0x169562[_0x3f68('0x1e')];var _0x19d5b5=_0x1d5366?0x0:_0x92e7d6[_0x3f68('0x1b')];var _0x47a13f=_0x1d5366?_0x169562['count']:_0x92e7d6[_0x3f68('0x1b')]+_0x92e7d6[_0x3f68('0x1d')];var _0x4dd1eb;if(_0x47a13f>=_0x4bb828){_0x47a13f=_0x4bb828;_0x4dd1eb=0xc8;}else{_0x4dd1eb=0xce;}_0x4580f8[_0x3f68('0x19')](_0x4dd1eb);return _0x4580f8[_0x3f68('0x1f')](_0x3f68('0x20'),_0x19d5b5+'-'+_0x47a13f+'/'+_0x4bb828)[_0x3f68('0x21')](_0x169562);}return null;};}function patchUpdates(_0x17b880){return function(_0x3ce514){try{jsonpatch['apply'](_0x3ce514,_0x17b880,!![]);}catch(_0x34c07f){return BPromise[_0x3f68('0x22')](_0x34c07f);}return _0x3ce514[_0x3f68('0x23')]();};}function saveUpdates(_0x154d6f,_0x338673){return function(_0x11b6b1){if(_0x11b6b1){return _0x11b6b1[_0x3f68('0x24')](_0x154d6f)[_0x3f68('0x25')](function(_0x5447a0){return _0x5447a0;});}return null;};}function removeEntity(_0xf8d210,_0x376570){return function(_0x501339){if(_0x501339){return _0x501339['destroy']()['then'](function(){_0xf8d210['status'](0xcc)[_0x3f68('0x1a')]();});}};}function handleEntityNotFound(_0x5c3d74,_0x5b5de4){return function(_0x32db4c){if(!_0x32db4c){_0x5c3d74[_0x3f68('0x18')](0x194);}return _0x32db4c;};}function handleError(_0xb4d61c,_0x1152f9){_0x1152f9=_0x1152f9||0x1f4;return function(_0x45de30){logger[_0x3f68('0x26')](_0x45de30[_0x3f68('0x27')]);if(_0x45de30[_0x3f68('0x28')]){delete _0x45de30[_0x3f68('0x28')];}_0xb4d61c['status'](_0x1152f9)['send'](_0x45de30);};}exports[_0x3f68('0x29')]=function(_0x373239,_0x631179,_0x393e71){if(!_0x373239[_0x3f68('0x2a')]['hasOwnProperty'](_0x3f68('0x2b'))&&!_0x373239[_0x3f68('0x2a')]['hasOwnProperty'](_0x3f68('0x2c'))){throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x373239[_0x3f68('0x2a')]['hasOwnProperty']('TemplateId')&&!_0x373239['body'][_0x3f68('0x2f')](_0x3f68('0x30'))){throw new db[(_0x3f68('0x2d'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x373239[_0x3f68('0x2a')][_0x3f68('0x2f')](_0x3f68('0x31'))){throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))](_0x3f68('0x32'));}else{try{var _0x4fa409=JSON[_0x3f68('0x33')](_0x373239[_0x3f68('0x2a')][_0x3f68('0x31')]);}catch(_0x1b7d3c){logger[_0x3f68('0x26')](_0x1b7d3c);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x4d2810=['chatqueue',_0x3f68('0x34'),_0x3f68('0x35'),'openchannelqueue',_0x3f68('0x36'),_0x3f68('0x37'),_0x3f68('0x38'),'team',_0x3f68('0x39')];if(_[_0x3f68('0x3a')](_0x4fa409,function(_0x5823f2){return!_[_0x3f68('0x3b')](_0x4d2810,_0x5823f2[_0x3f68('0x3c')][_0x3f68('0x3d')]());})){throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))](_0x3f68('0x3e'));}}}var _0x5b7266={};_0x5b7266[_0x3f68('0x3f')]=_0x373239['body'][_0x3f68('0x2f')](_0x3f68('0x3f'))?_0x373239[_0x3f68('0x2a')]['senderName']:_0x373239['user'][_0x3f68('0x40')];_0x5b7266[_0x3f68('0x41')]=_[_0x3f68('0x42')](_0x373239['body']['recipientsDescription'])?null:_0x373239[_0x3f68('0x2a')][_0x3f68('0x41')];_0x5b7266[_0x3f68('0x43')]=_0x373239['body'][_0x3f68('0x43')]||![];_0x5b7266[_0x3f68('0x44')]=_0x373239[_0x3f68('0x39')]['id'];return getContent(_0x373239[_0x3f68('0x2a')])[_0x3f68('0x25')](function(_0x11c888){_0x5b7266['body']=_0x11c888;return getRecipients(_0x4fa409);})[_0x3f68('0x25')](function(_0x4ec8d9){_0x5b7266['recipientsId']=_[_0x3f68('0x45')](_0x4ec8d9)[_0x3f68('0x46')](',');return db[_0x3f68('0x47')][_0x3f68('0x48')](function(_0x156889){return db[_0x3f68('0x49')][_0x3f68('0x4a')](_0x5b7266,{'raw':!![],'transaction':_0x156889})[_0x3f68('0x25')](function(_0x1153b3){var _0x31ecd4={'sender':_0x5b7266[_0x3f68('0x3f')],'description':_0x5b7266[_0x3f68('0x41')],'content':_0x5b7266['body'],'beep':_0x5b7266['beep']};_0x4ec8d9[_0x3f68('0x4b')](function(_0x914b9b){_0x31ecd4['recipient']=_0x914b9b;socket['emit']('userNotification:send',_0x31ecd4);});return _0x1153b3;});});})[_0x3f68('0x25')](respondWithResult(_0x631179,0xc9))['catch'](handleError(_0x631179,null));};function getContent(_0x17d284){return new BPromise(function(_0x47f7e9,_0x5d26ba){if(_0x17d284[_0x3f68('0x2b')]){_0x47f7e9(_0x17d284['text']);return;}return db[_0x3f68('0x4c')]['findOne']({'attributes':['html'],'where':{'id':_0x17d284[_0x3f68('0x2c')]},'raw':!![]})[_0x3f68('0x25')](function(_0x192e87){if(!_0x192e87)throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x8b4d6e=Mustache['render'](_0x192e87[_0x3f68('0x4d')],_0x17d284['view']);_0x47f7e9(_0x8b4d6e);})['catch'](function(_0x1b420c){_0x5d26ba(_0x1b420c);});});}function getRecipients(_0x3d347d){return new BPromise(function(_0x2afc07,_0x345329){var _0xcc8cdd=[];var _0x3610a6=[];_0x3d347d[_0x3f68('0x4b')](function(_0x2df3fe){var _0x1c7621=_[_0x3f68('0x4e')](_0x2df3fe[_0x3f68('0x3c')][_0x3f68('0x3d')]());if(_0x1c7621===_0x3f68('0x4f')){_0xcc8cdd=_[_0x3f68('0x50')](_0xcc8cdd,_0x2df3fe[_0x3f68('0x51')]);}else{if(_[_0x3f68('0x3b')](_0x1c7621,_0x3f68('0x52')))_0x1c7621=_0x1c7621[_0x3f68('0x53')](_0x3f68('0x52'),_0x3f68('0x54'));_0x2df3fe['ids'][_0x3f68('0x4b')](function(_0x121a81){_0x3610a6[_0x3f68('0x55')](getAgents(_0x1c7621,_0x121a81));});}});return BPromise[_0x3f68('0x56')](_0x3610a6)[_0x3f68('0x25')](function(_0x138aab){_0xcc8cdd=_[_0x3f68('0x50')](_0xcc8cdd,_['flatten'](_0x138aab));_0x2afc07(_0xcc8cdd);})[_0x3f68('0x57')](function(_0x3430f2){_0x345329(_0x3430f2);});});}function getAgents(_0x3847ea,_0x595031){return new BPromise(function(_0x103e4d,_0x4dcd5b){return db[_0x3847ea][_0x3f68('0x58')]({'where':{'id':_0x595031}})['then'](function(_0x3f5cff){return _0x3f5cff[_0x3f68('0x59')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4eed77){var _0x6231ff=_[_0x3f68('0x5a')](_0x4eed77,'id');_0x103e4d(_0x6231ff);});})['catch'](function(_0x23fd63){_0x4dcd5b(_0x23fd63);});});}
\ No newline at end of file
+var _0x9074=['../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','sendUserNotification','text','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','UserNotification','create','forEach','emit','userNotification:send','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','model','User','ids','queue','replace','Queue','union','flatten','findOne','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x14b7c4,_0x3ce59c){var _0x18ef66=function(_0xdc96d1){while(--_0xdc96d1){_0x14b7c4['push'](_0x14b7c4['shift']());}};_0x18ef66(++_0x3ce59c);}(_0x9074,0x120));var _0x4907=function(_0x4799e5,_0x3d622f){_0x4799e5=_0x4799e5-0x0;var _0x4ed3e4=_0x9074[_0x4799e5];return _0x4ed3e4;};'use strict';var emlformat=require(_0x4907('0x0'));var rimraf=require(_0x4907('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4907('0x2'));var rp=require(_0x4907('0x3'));var moment=require(_0x4907('0x4'));var BPromise=require(_0x4907('0x5'));var Mustache=require(_0x4907('0x6'));var util=require(_0x4907('0x7'));var path=require(_0x4907('0x8'));var sox=require(_0x4907('0x9'));var csv=require(_0x4907('0xa'));var ejs=require(_0x4907('0xb'));var fs=require('fs');var fs_extra=require(_0x4907('0xc'));var _=require(_0x4907('0xd'));var squel=require(_0x4907('0xe'));var crypto=require(_0x4907('0xf'));var jsforce=require(_0x4907('0x10'));var deskjs=require(_0x4907('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4907('0x12'));var Papa=require('papaparse');var Redis=require(_0x4907('0x13'));var authService=require(_0x4907('0x14'));var qs=require(_0x4907('0x15'));var as=require(_0x4907('0x16'));var hardwareService=require(_0x4907('0x17'));var logger=require(_0x4907('0x18'))(_0x4907('0x19'));var utils=require('../../config/utils');var config=require(_0x4907('0x1a'));var licenseUtil=require(_0x4907('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4907('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4907('0x1d')]));require(_0x4907('0x1e'))[_0x4907('0x1f')](socket);function respondWithStatusCode(_0x401333,_0x250f75){_0x250f75=_0x250f75||0xcc;return function(_0x33ac33){if(_0x33ac33){return _0x401333[_0x4907('0x20')](_0x250f75);}return _0x401333[_0x4907('0x21')](_0x250f75)[_0x4907('0x22')]();};}function respondWithResult(_0xee5e98,_0x3ff7a5){_0x3ff7a5=_0x3ff7a5||0xc8;return function(_0x1f8069){if(_0x1f8069){return _0xee5e98[_0x4907('0x21')](_0x3ff7a5)[_0x4907('0x23')](_0x1f8069);}};}function respondWithFilteredResult(_0x433517,_0xd9554a){return function(_0x2924c6){if(_0x2924c6){var _0x8072ea=typeof _0xd9554a[_0x4907('0x24')]==='undefined'&&typeof _0xd9554a[_0x4907('0x25')]===_0x4907('0x26');var _0x4e3dcc=_0x2924c6[_0x4907('0x27')];var _0x142be4=_0x8072ea?0x0:_0xd9554a[_0x4907('0x24')];var _0xddb107=_0x8072ea?_0x2924c6[_0x4907('0x27')]:_0xd9554a['offset']+_0xd9554a['limit'];var _0x290f4a;if(_0xddb107>=_0x4e3dcc){_0xddb107=_0x4e3dcc;_0x290f4a=0xc8;}else{_0x290f4a=0xce;}_0x433517['status'](_0x290f4a);return _0x433517[_0x4907('0x28')](_0x4907('0x29'),_0x142be4+'-'+_0xddb107+'/'+_0x4e3dcc)[_0x4907('0x23')](_0x2924c6);}return null;};}function patchUpdates(_0x4376a0){return function(_0x533800){try{jsonpatch[_0x4907('0x2a')](_0x533800,_0x4376a0,!![]);}catch(_0x40dc59){return BPromise[_0x4907('0x2b')](_0x40dc59);}return _0x533800['save']();};}function saveUpdates(_0x24492f,_0x22cf0b){return function(_0x544cc2){if(_0x544cc2){return _0x544cc2[_0x4907('0x2c')](_0x24492f)['then'](function(_0x2712be){return _0x2712be;});}return null;};}function removeEntity(_0x6b129c,_0x13ae43){return function(_0x40d8d0){if(_0x40d8d0){return _0x40d8d0[_0x4907('0x2d')]()[_0x4907('0x2e')](function(){_0x6b129c[_0x4907('0x21')](0xcc)[_0x4907('0x22')]();});}};}function handleEntityNotFound(_0x41b633,_0x372735){return function(_0x45deea){if(!_0x45deea){_0x41b633[_0x4907('0x20')](0x194);}return _0x45deea;};}function handleError(_0x128b8a,_0x203ec8){_0x203ec8=_0x203ec8||0x1f4;return function(_0x1a1b7e){logger['error'](_0x1a1b7e[_0x4907('0x2f')]);if(_0x1a1b7e[_0x4907('0x30')]){delete _0x1a1b7e[_0x4907('0x30')];}_0x128b8a[_0x4907('0x21')](_0x203ec8)[_0x4907('0x31')](_0x1a1b7e);};}exports[_0x4907('0x32')]=function(_0x34b4e5,_0x85b177,_0x2f31ad){if(!_0x34b4e5['body']['hasOwnProperty'](_0x4907('0x33'))&&!_0x34b4e5[_0x4907('0x34')][_0x4907('0x35')]('TemplateId')){throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x38'));}else{if(_0x34b4e5['body'][_0x4907('0x35')](_0x4907('0x39'))&&!_0x34b4e5[_0x4907('0x34')][_0x4907('0x35')]('view')){throw new db['Sequelize'][(_0x4907('0x37'))](_0x4907('0x3a'));}if(!_0x34b4e5[_0x4907('0x34')][_0x4907('0x35')]('recipients')){throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x3b'));}else{try{var _0x4a27b4=JSON[_0x4907('0x3c')](_0x34b4e5[_0x4907('0x34')][_0x4907('0x3d')]);}catch(_0x462d66){logger[_0x4907('0x3e')](_0x462d66);throw new db['Sequelize'][(_0x4907('0x37'))](_0x4907('0x3f'));}var _0x2c56bd=[_0x4907('0x40'),'faxqueue',_0x4907('0x41'),'openchannelqueue',_0x4907('0x42'),_0x4907('0x43'),_0x4907('0x44'),_0x4907('0x45'),'user'];if(_[_0x4907('0x46')](_0x4a27b4,function(_0x50f29a){return!_[_0x4907('0x47')](_0x2c56bd,_0x50f29a['model'][_0x4907('0x48')]());})){throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x49'));}}}var _0x2a2f2e={};_0x2a2f2e['senderName']=_0x34b4e5['body'][_0x4907('0x35')](_0x4907('0x4a'))?_0x34b4e5[_0x4907('0x34')][_0x4907('0x4a')]:_0x34b4e5[_0x4907('0x4b')][_0x4907('0x4c')];_0x2a2f2e[_0x4907('0x4d')]=_[_0x4907('0x4e')](_0x34b4e5[_0x4907('0x34')]['recipientsDescription'])?null:_0x34b4e5[_0x4907('0x34')][_0x4907('0x4d')];_0x2a2f2e['beep']=_0x34b4e5[_0x4907('0x34')][_0x4907('0x4f')]||![];_0x2a2f2e[_0x4907('0x50')]=_0x34b4e5[_0x4907('0x4b')]['id'];return getContent(_0x34b4e5[_0x4907('0x34')])[_0x4907('0x2e')](function(_0x5196f4){_0x2a2f2e[_0x4907('0x34')]=_0x5196f4;return getRecipients(_0x4a27b4);})[_0x4907('0x2e')](function(_0x18a590){_0x2a2f2e['recipientsId']=_[_0x4907('0x51')](_0x18a590)['join'](',');return db[_0x4907('0x52')]['transaction'](function(_0x4b4cfc){return db[_0x4907('0x53')][_0x4907('0x54')](_0x2a2f2e,{'raw':!![],'transaction':_0x4b4cfc})[_0x4907('0x2e')](function(_0x4b4301){var _0xc52b5a={'sender':_0x2a2f2e[_0x4907('0x4a')],'description':_0x2a2f2e[_0x4907('0x4d')],'content':_0x2a2f2e[_0x4907('0x34')],'beep':_0x2a2f2e['beep']};_0x18a590[_0x4907('0x55')](function(_0x48ce67){_0xc52b5a['recipient']=_0x48ce67;socket[_0x4907('0x56')](_0x4907('0x57'),_0xc52b5a);});return _0x4b4301;});});})[_0x4907('0x2e')](respondWithResult(_0x85b177,0xc9))['catch'](handleError(_0x85b177,null));};function getContent(_0x314b0e){return new BPromise(function(_0x2af8a9,_0x25abd4){if(_0x314b0e['text']){_0x2af8a9(_0x314b0e['text']);return;}return db[_0x4907('0x58')]['findOne']({'attributes':[_0x4907('0x59')],'where':{'id':_0x314b0e[_0x4907('0x39')]},'raw':!![]})['then'](function(_0x3cbfaa){if(!_0x3cbfaa)throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x5a'));var _0x44bf77=Mustache[_0x4907('0x5b')](_0x3cbfaa[_0x4907('0x59')],_0x314b0e['view']);_0x2af8a9(_0x44bf77);})[_0x4907('0x5c')](function(_0x3ccbd9){_0x25abd4(_0x3ccbd9);});});}function getRecipients(_0x54dbef){return new BPromise(function(_0x3bc19b,_0x1f91e2){var _0x24f2e7=[];var _0x270008=[];_0x54dbef['forEach'](function(_0x4c68e2){var _0x198394=_['startCase'](_0x4c68e2[_0x4907('0x5d')][_0x4907('0x48')]());if(_0x198394===_0x4907('0x5e')){_0x24f2e7=_['union'](_0x24f2e7,_0x4c68e2[_0x4907('0x5f')]);}else{if(_[_0x4907('0x47')](_0x198394,_0x4907('0x60')))_0x198394=_0x198394[_0x4907('0x61')]('queue',_0x4907('0x62'));_0x4c68e2[_0x4907('0x5f')][_0x4907('0x55')](function(_0x2b9da4){_0x270008['push'](getAgents(_0x198394,_0x2b9da4));});}});return BPromise['all'](_0x270008)[_0x4907('0x2e')](function(_0xfc5322){_0x24f2e7=_[_0x4907('0x63')](_0x24f2e7,_[_0x4907('0x64')](_0xfc5322));_0x3bc19b(_0x24f2e7);})[_0x4907('0x5c')](function(_0x1921ba){_0x1f91e2(_0x1921ba);});});}function getAgents(_0x22e52e,_0x9b4747){return new BPromise(function(_0x3a6ed0,_0x260872){return db[_0x22e52e][_0x4907('0x65')]({'where':{'id':_0x9b4747}})[_0x4907('0x2e')](function(_0x5eebee){return _0x5eebee[_0x4907('0x66')]({'attributes':['id'],'raw':!![]})['then'](function(_0x51e7b6){var _0x66870e=_[_0x4907('0x67')](_0x51e7b6,'id');_0x3a6ed0(_0x66870e);});})[_0x4907('0x5c')](function(_0x43934d){_0x260872(_0x43934d);});});}
\ No newline at end of file