Built motion from commit 97f2f211.|2.6.31
[motion2.git] / server / api / userNotification / userNotification.controller.js
index 53825e2..44d8471 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27a8=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','offset','limit','count','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','beep','recipientsId','join','sequelize','transaction','UserNotification','create','recipientsDescription','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','union','replace','queue','Queue','all','flatten','getAgents','eml-format','zip-dir','request-promise','moment','sox'];(function(_0x4fd5b8,_0x5bdc7d){var _0x44f50c=function(_0x5d8821){while(--_0x5d8821){_0x4fd5b8['push'](_0x4fd5b8['shift']());}};_0x44f50c(++_0x5bdc7d);}(_0x27a8,0xb5));var _0x827a=function(_0x23eb7d,_0x3ba334){_0x23eb7d=_0x23eb7d-0x0;var _0x27589c=_0x27a8[_0x23eb7d];return _0x27589c;};'use strict';var emlformat=require(_0x827a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x827a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x827a('0x2'));var moment=require(_0x827a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x827a('0x4'));var csv=require(_0x827a('0x5'));var ejs=require(_0x827a('0x6'));var fs=require('fs');var fs_extra=require(_0x827a('0x7'));var _=require(_0x827a('0x8'));var squel=require(_0x827a('0x9'));var crypto=require(_0x827a('0xa'));var jsforce=require(_0x827a('0xb'));var deskjs=require(_0x827a('0xc'));var toCsv=require(_0x827a('0x5'));var querystring=require(_0x827a('0xd'));var Papa=require(_0x827a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x827a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x827a('0x10'));var logger=require(_0x827a('0x11'))(_0x827a('0x12'));var utils=require(_0x827a('0x13'));var config=require(_0x827a('0x14'));var licenseUtil=require(_0x827a('0x15'));var db=require('../../mysqldb')['db'];config[_0x827a('0x16')]=_[_0x827a('0x17')](config[_0x827a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x827a('0x18'))(new Redis(config[_0x827a('0x16')]));require(_0x827a('0x19'))[_0x827a('0x1a')](socket);function respondWithStatusCode(_0x482e92,_0x5952af){_0x5952af=_0x5952af||0xcc;return function(_0x53c261){if(_0x53c261){return _0x482e92[_0x827a('0x1b')](_0x5952af);}return _0x482e92['status'](_0x5952af)['end']();};}function respondWithResult(_0x31836b,_0x301131){_0x301131=_0x301131||0xc8;return function(_0x3e9957){if(_0x3e9957){return _0x31836b[_0x827a('0x1c')](_0x301131)['json'](_0x3e9957);}};}function respondWithFilteredResult(_0x1f30db,_0x578ba9){return function(_0x24e05a){if(_0x24e05a){var _0x5996cc=typeof _0x578ba9[_0x827a('0x1d')]==='undefined'&&typeof _0x578ba9[_0x827a('0x1e')]==='undefined';var _0x108275=_0x24e05a['count'];var _0x1e2e28=_0x5996cc?0x0:_0x578ba9['offset'];var _0x106b16=_0x5996cc?_0x24e05a[_0x827a('0x1f')]:_0x578ba9[_0x827a('0x1d')]+_0x578ba9['limit'];var _0xe64e7e;if(_0x106b16>=_0x108275){_0x106b16=_0x108275;_0xe64e7e=0xc8;}else{_0xe64e7e=0xce;}_0x1f30db[_0x827a('0x1c')](_0xe64e7e);return _0x1f30db['set'](_0x827a('0x20'),_0x1e2e28+'-'+_0x106b16+'/'+_0x108275)[_0x827a('0x21')](_0x24e05a);}return null;};}function patchUpdates(_0x3dc697){return function(_0x2acb35){try{jsonpatch['apply'](_0x2acb35,_0x3dc697,!![]);}catch(_0x1d1402){return BPromise[_0x827a('0x22')](_0x1d1402);}return _0x2acb35[_0x827a('0x23')]();};}function saveUpdates(_0x2ed52e,_0x524813){return function(_0x1fa80f){if(_0x1fa80f){return _0x1fa80f[_0x827a('0x24')](_0x2ed52e)[_0x827a('0x25')](function(_0x368084){return _0x368084;});}return null;};}function removeEntity(_0x3d9b26,_0x397fef){return function(_0x516e4b){if(_0x516e4b){return _0x516e4b[_0x827a('0x26')]()['then'](function(){_0x3d9b26[_0x827a('0x1c')](0xcc)[_0x827a('0x27')]();});}};}function handleEntityNotFound(_0x1560ff,_0x55e727){return function(_0x2cf54c){if(!_0x2cf54c){_0x1560ff[_0x827a('0x1b')](0x194);}return _0x2cf54c;};}function handleError(_0x4a0c21,_0x27a56e){_0x27a56e=_0x27a56e||0x1f4;return function(_0x587ec2){logger[_0x827a('0x28')](_0x587ec2['stack']);if(_0x587ec2['name']){delete _0x587ec2[_0x827a('0x29')];}_0x4a0c21[_0x827a('0x1c')](_0x27a56e)[_0x827a('0x2a')](_0x587ec2);};}exports[_0x827a('0x2b')]=function(_0x1572f7,_0x46386e,_0x80ce8a){if(!_0x1572f7[_0x827a('0x2c')][_0x827a('0x2d')](_0x827a('0x2e'))&&!_0x1572f7[_0x827a('0x2c')]['hasOwnProperty'](_0x827a('0x2f'))){throw new db[(_0x827a('0x30'))][(_0x827a('0x31'))](_0x827a('0x32'));}else{if(_0x1572f7[_0x827a('0x2c')]['hasOwnProperty']('TemplateId')&&!_0x1572f7[_0x827a('0x2c')][_0x827a('0x2d')](_0x827a('0x33'))){throw new db['Sequelize'][(_0x827a('0x31'))](_0x827a('0x34'));}if(!_0x1572f7['body'][_0x827a('0x2d')](_0x827a('0x35'))){throw new db['Sequelize'][(_0x827a('0x31'))](_0x827a('0x36'));}else{try{var _0x1fc978=JSON['parse'](_0x1572f7['body'][_0x827a('0x35')]);}catch(_0x1fe848){logger[_0x827a('0x28')](_0x1fe848);throw new db['Sequelize']['ValidationError'](_0x827a('0x37'));}var _0x2df128=[_0x827a('0x38'),_0x827a('0x39'),_0x827a('0x3a'),'openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user'];if(_['some'](_0x1fc978,function(_0x28f916){return!_[_0x827a('0x3b')](_0x2df128,_0x28f916['model']['toLowerCase']());})){throw new db['Sequelize']['ValidationError'](_0x827a('0x3c'));}}}var _0x59e2a0={};_0x59e2a0[_0x827a('0x3d')]=_0x1572f7['body'][_0x827a('0x2d')]('senderName')?_0x1572f7[_0x827a('0x2c')]['senderName']:_0x1572f7[_0x827a('0x3e')][_0x827a('0x3f')];_0x59e2a0['recipientsDescription']=_[_0x827a('0x40')](_0x1572f7[_0x827a('0x2c')]['recipientsDescription'])?null:_0x1572f7['body']['recipientsDescription'];_0x59e2a0[_0x827a('0x41')]=_0x1572f7[_0x827a('0x2c')]['beep']||![];_0x59e2a0['SenderId']=_0x1572f7['user']['id'];return getContent(_0x1572f7[_0x827a('0x2c')])['then'](function(_0x54d6e0){_0x59e2a0[_0x827a('0x2c')]=_0x54d6e0;return getRecipients(_0x1fc978);})['then'](function(_0x566316){_0x59e2a0[_0x827a('0x42')]=_['sortBy'](_0x566316)[_0x827a('0x43')](',');return db[_0x827a('0x44')][_0x827a('0x45')](function(_0x35330a){return db[_0x827a('0x46')][_0x827a('0x47')](_0x59e2a0,{'raw':!![],'transaction':_0x35330a})[_0x827a('0x25')](function(_0x5bede9){var _0x39b52b={'sender':_0x59e2a0[_0x827a('0x3d')],'description':_0x59e2a0[_0x827a('0x48')],'content':_0x59e2a0['body'],'beep':_0x59e2a0[_0x827a('0x41')]};_0x566316[_0x827a('0x49')](function(_0x48b9f3){_0x39b52b[_0x827a('0x4a')]=_0x48b9f3;socket[_0x827a('0x4b')](_0x827a('0x4c'),_0x39b52b);});return _0x5bede9;});});})['then'](respondWithResult(_0x46386e,0xc9))[_0x827a('0x4d')](handleError(_0x46386e,null));};function getContent(_0x28bf46){return new BPromise(function(_0x2520fe,_0x5dea2b){if(_0x28bf46[_0x827a('0x2e')]){_0x2520fe(_0x28bf46[_0x827a('0x2e')]);return;}return db[_0x827a('0x4e')][_0x827a('0x4f')]({'attributes':[_0x827a('0x50')],'where':{'id':_0x28bf46[_0x827a('0x2f')]},'raw':!![]})[_0x827a('0x25')](function(_0x1e9a10){if(!_0x1e9a10)throw new db[(_0x827a('0x30'))][(_0x827a('0x31'))](_0x827a('0x51'));var _0xf87dc=Mustache[_0x827a('0x52')](_0x1e9a10[_0x827a('0x50')],_0x28bf46[_0x827a('0x33')]);_0x2520fe(_0xf87dc);})[_0x827a('0x4d')](function(_0x361099){_0x5dea2b(_0x361099);});});}function getRecipients(_0xf3e9e2){return new BPromise(function(_0x396324,_0x3e18d9){var _0x5a3897=[];var _0x188b73=[];_0xf3e9e2[_0x827a('0x49')](function(_0x4d90aa){var _0x35c830=_[_0x827a('0x53')](_0x4d90aa[_0x827a('0x54')]['toLowerCase']());if(_0x35c830===_0x827a('0x55')){_0x5a3897=_[_0x827a('0x56')](_0x5a3897,_0x4d90aa['ids']);}else{if(_[_0x827a('0x3b')](_0x35c830,'queue'))_0x35c830=_0x35c830[_0x827a('0x57')](_0x827a('0x58'),_0x827a('0x59'));_0x4d90aa['ids'][_0x827a('0x49')](function(_0x522606){_0x188b73['push'](getAgents(_0x35c830,_0x522606));});}});return BPromise[_0x827a('0x5a')](_0x188b73)[_0x827a('0x25')](function(_0x5c6642){_0x5a3897=_[_0x827a('0x56')](_0x5a3897,_[_0x827a('0x5b')](_0x5c6642));_0x396324(_0x5a3897);})[_0x827a('0x4d')](function(_0x211049){_0x3e18d9(_0x211049);});});}function getAgents(_0x2e9f7e,_0x268ae2){return new BPromise(function(_0x275dbb,_0x4ad805){return db[_0x2e9f7e][_0x827a('0x4f')]({'where':{'id':_0x268ae2}})[_0x827a('0x25')](function(_0x1e2940){return _0x1e2940[_0x827a('0x5c')]({'attributes':['id'],'raw':!![]})[_0x827a('0x25')](function(_0x34e194){var _0x50c330=_['map'](_0x34e194,'id');_0x275dbb(_0x50c330);});})[_0x827a('0x4d')](function(_0x597dbd){_0x4ad805(_0x597dbd);});});}
\ No newline at end of file
+var _0x9f70=['user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','UserNotification','create','forEach','recipient','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','queue','replace','ids','push','flatten','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','view','ValidationError','recipients','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','smsqueue','whatsappqueue','team'];(function(_0xbc5d73,_0x4d7000){var _0xcf16e1=function(_0x5569b7){while(--_0x5569b7){_0xbc5d73['push'](_0xbc5d73['shift']());}};_0xcf16e1(++_0x4d7000);}(_0x9f70,0x14b));var _0x09f7=function(_0x277a69,_0x127dd5){_0x277a69=_0x277a69-0x0;var _0x45f9db=_0x9f70[_0x277a69];return _0x45f9db;};'use strict';var emlformat=require(_0x09f7('0x0'));var rimraf=require(_0x09f7('0x1'));var zipdir=require(_0x09f7('0x2'));var jsonpatch=require(_0x09f7('0x3'));var rp=require(_0x09f7('0x4'));var moment=require(_0x09f7('0x5'));var BPromise=require(_0x09f7('0x6'));var Mustache=require(_0x09f7('0x7'));var util=require(_0x09f7('0x8'));var path=require('path');var sox=require(_0x09f7('0x9'));var csv=require(_0x09f7('0xa'));var ejs=require(_0x09f7('0xb'));var fs=require('fs');var fs_extra=require(_0x09f7('0xc'));var _=require(_0x09f7('0xd'));var squel=require(_0x09f7('0xe'));var crypto=require(_0x09f7('0xf'));var jsforce=require(_0x09f7('0x10'));var deskjs=require(_0x09f7('0x11'));var toCsv=require(_0x09f7('0xa'));var querystring=require(_0x09f7('0x12'));var Papa=require(_0x09f7('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x09f7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09f7('0x15'))(_0x09f7('0x16'));var utils=require(_0x09f7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x09f7('0x18'));var db=require(_0x09f7('0x19'))['db'];config[_0x09f7('0x1a')]=_[_0x09f7('0x1b')](config['redis'],{'host':_0x09f7('0x1c'),'port':0x18eb});var socket=require(_0x09f7('0x1d'))(new Redis(config['redis']));require(_0x09f7('0x1e'))[_0x09f7('0x1f')](socket);function respondWithStatusCode(_0x4d2a39,_0x549212){_0x549212=_0x549212||0xcc;return function(_0x4c8ed2){if(_0x4c8ed2){return _0x4d2a39[_0x09f7('0x20')](_0x549212);}return _0x4d2a39[_0x09f7('0x21')](_0x549212)[_0x09f7('0x22')]();};}function respondWithResult(_0x280d23,_0x529984){_0x529984=_0x529984||0xc8;return function(_0x5e403c){if(_0x5e403c){return _0x280d23['status'](_0x529984)[_0x09f7('0x23')](_0x5e403c);}};}function respondWithFilteredResult(_0x573386,_0x1e83be){return function(_0x942369){if(_0x942369){var _0x112b7d=typeof _0x1e83be['offset']==='undefined'&&typeof _0x1e83be['limit']===_0x09f7('0x24');var _0x215787=_0x942369[_0x09f7('0x25')];var _0x4a0af2=_0x112b7d?0x0:_0x1e83be['offset'];var _0x591691=_0x112b7d?_0x942369[_0x09f7('0x25')]:_0x1e83be[_0x09f7('0x26')]+_0x1e83be[_0x09f7('0x27')];var _0x390c03;if(_0x591691>=_0x215787){_0x591691=_0x215787;_0x390c03=0xc8;}else{_0x390c03=0xce;}_0x573386[_0x09f7('0x21')](_0x390c03);return _0x573386[_0x09f7('0x28')](_0x09f7('0x29'),_0x4a0af2+'-'+_0x591691+'/'+_0x215787)[_0x09f7('0x23')](_0x942369);}return null;};}function patchUpdates(_0x5b3d89){return function(_0x4a97e6){try{jsonpatch[_0x09f7('0x2a')](_0x4a97e6,_0x5b3d89,!![]);}catch(_0x5c83a8){return BPromise['reject'](_0x5c83a8);}return _0x4a97e6[_0x09f7('0x2b')]();};}function saveUpdates(_0x30b309,_0x5addc1){return function(_0x4e5100){if(_0x4e5100){return _0x4e5100[_0x09f7('0x2c')](_0x30b309)[_0x09f7('0x2d')](function(_0xe82b25){return _0xe82b25;});}return null;};}function removeEntity(_0x265da8,_0x4007eb){return function(_0xe4762){if(_0xe4762){return _0xe4762[_0x09f7('0x2e')]()[_0x09f7('0x2d')](function(){_0x265da8[_0x09f7('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aff3e,_0x39db2c){return function(_0x249cc8){if(!_0x249cc8){_0x3aff3e['sendStatus'](0x194);}return _0x249cc8;};}function handleError(_0x35bd49,_0x3ab4ee){_0x3ab4ee=_0x3ab4ee||0x1f4;return function(_0x4034fe){logger[_0x09f7('0x2f')](_0x4034fe[_0x09f7('0x30')]);if(_0x4034fe['name']){delete _0x4034fe[_0x09f7('0x31')];}_0x35bd49['status'](_0x3ab4ee)[_0x09f7('0x32')](_0x4034fe);};}exports[_0x09f7('0x33')]=function(_0x394235,_0x5c3103,_0x44d40a){if(!_0x394235[_0x09f7('0x34')][_0x09f7('0x35')]('text')&&!_0x394235[_0x09f7('0x34')]['hasOwnProperty'](_0x09f7('0x36'))){throw new db[(_0x09f7('0x37'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x394235['body'][_0x09f7('0x35')](_0x09f7('0x36'))&&!_0x394235['body']['hasOwnProperty'](_0x09f7('0x38'))){throw new db['Sequelize'][(_0x09f7('0x39'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x394235[_0x09f7('0x34')][_0x09f7('0x35')](_0x09f7('0x3a'))){throw new db[(_0x09f7('0x37'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x354718=JSON[_0x09f7('0x3b')](_0x394235[_0x09f7('0x34')][_0x09f7('0x3a')]);}catch(_0x2caa42){logger[_0x09f7('0x2f')](_0x2caa42);throw new db['Sequelize']['ValidationError'](_0x09f7('0x3c'));}var _0x36c1b4=['chatqueue',_0x09f7('0x3d'),'mailqueue','openchannelqueue',_0x09f7('0x3e'),'voicequeue',_0x09f7('0x3f'),_0x09f7('0x40'),_0x09f7('0x41')];if(_[_0x09f7('0x42')](_0x354718,function(_0x2d786b){return!_[_0x09f7('0x43')](_0x36c1b4,_0x2d786b[_0x09f7('0x44')][_0x09f7('0x45')]());})){throw new db['Sequelize']['ValidationError'](_0x09f7('0x46'));}}}var _0x167cf7={};_0x167cf7[_0x09f7('0x47')]=_0x394235[_0x09f7('0x34')]['hasOwnProperty'](_0x09f7('0x47'))?_0x394235['body']['senderName']:_0x394235[_0x09f7('0x41')][_0x09f7('0x48')];_0x167cf7['recipientsDescription']=_[_0x09f7('0x49')](_0x394235['body'][_0x09f7('0x4a')])?null:_0x394235['body'][_0x09f7('0x4a')];_0x167cf7[_0x09f7('0x4b')]=_0x394235[_0x09f7('0x34')][_0x09f7('0x4b')]||![];_0x167cf7[_0x09f7('0x4c')]=_0x394235[_0x09f7('0x41')]['id'];return getContent(_0x394235[_0x09f7('0x34')])[_0x09f7('0x2d')](function(_0x4781ef){_0x167cf7['body']=_0x4781ef;return getRecipients(_0x354718);})[_0x09f7('0x2d')](function(_0x48e1dc){_0x167cf7[_0x09f7('0x4d')]=_['sortBy'](_0x48e1dc)[_0x09f7('0x4e')](',');return db[_0x09f7('0x4f')]['transaction'](function(_0x2e17c4){return db[_0x09f7('0x50')][_0x09f7('0x51')](_0x167cf7,{'raw':!![],'transaction':_0x2e17c4})[_0x09f7('0x2d')](function(_0x63f48d){var _0x2588e3={'sender':_0x167cf7[_0x09f7('0x47')],'description':_0x167cf7['recipientsDescription'],'content':_0x167cf7[_0x09f7('0x34')],'beep':_0x167cf7[_0x09f7('0x4b')]};_0x48e1dc[_0x09f7('0x52')](function(_0x5d5db8){_0x2588e3[_0x09f7('0x53')]=_0x5d5db8;socket['emit'](_0x09f7('0x54'),_0x2588e3);});return _0x63f48d;});});})[_0x09f7('0x2d')](respondWithResult(_0x5c3103,0xc9))[_0x09f7('0x55')](handleError(_0x5c3103,null));};function getContent(_0x311d17){return new BPromise(function(_0x1e7c03,_0x535b55){if(_0x311d17[_0x09f7('0x56')]){_0x1e7c03(_0x311d17[_0x09f7('0x56')]);return;}return db[_0x09f7('0x57')][_0x09f7('0x58')]({'attributes':[_0x09f7('0x59')],'where':{'id':_0x311d17['TemplateId']},'raw':!![]})[_0x09f7('0x2d')](function(_0x1ae3db){if(!_0x1ae3db)throw new db[(_0x09f7('0x37'))][(_0x09f7('0x39'))](_0x09f7('0x5a'));var _0x3ab2cd=Mustache['render'](_0x1ae3db[_0x09f7('0x59')],_0x311d17['view']);_0x1e7c03(_0x3ab2cd);})['catch'](function(_0x4d6247){_0x535b55(_0x4d6247);});});}function getRecipients(_0x1ec440){return new BPromise(function(_0x49ac26,_0x59bc6c){var _0x3b4e0e=[];var _0x4b6165=[];_0x1ec440['forEach'](function(_0x4e34c4){var _0x543820=_[_0x09f7('0x5b')](_0x4e34c4[_0x09f7('0x44')][_0x09f7('0x45')]());if(_0x543820===_0x09f7('0x5c')){_0x3b4e0e=_[_0x09f7('0x5d')](_0x3b4e0e,_0x4e34c4['ids']);}else{if(_[_0x09f7('0x43')](_0x543820,_0x09f7('0x5e')))_0x543820=_0x543820[_0x09f7('0x5f')](_0x09f7('0x5e'),'Queue');_0x4e34c4[_0x09f7('0x60')][_0x09f7('0x52')](function(_0x413264){_0x4b6165[_0x09f7('0x61')](getAgents(_0x543820,_0x413264));});}});return BPromise['all'](_0x4b6165)[_0x09f7('0x2d')](function(_0x13f304){_0x3b4e0e=_['union'](_0x3b4e0e,_[_0x09f7('0x62')](_0x13f304));_0x49ac26(_0x3b4e0e);})[_0x09f7('0x55')](function(_0x368b4e){_0x59bc6c(_0x368b4e);});});}function getAgents(_0x4a1c68,_0x44fdae){return new BPromise(function(_0x1b91a4,_0x3b1db7){return db[_0x4a1c68][_0x09f7('0x58')]({'where':{'id':_0x44fdae}})['then'](function(_0x26c5eb){return _0x26c5eb['getAgents']({'attributes':['id'],'raw':!![]})[_0x09f7('0x2d')](function(_0x1456fa){var _0x2d0feb=_['map'](_0x1456fa,'id');_0x1b91a4(_0x2d0feb);});})[_0x09f7('0x55')](function(_0x50fedb){_0x3b1db7(_0x50fedb);});});}
\ No newline at end of file